Omni Systems, Inc.

  

Mif2Go User's Guide, Version 55

  

Valid HTML 4.01!

 

Made with Mif2Go

22 Setting up CSS for HTML > 22.7 Assigning CSS classes > 22.7.11 Overriding CSS class for selected paragraphs


22.7.11 Overriding CSS class for selected paragraphs

Paragraphs that have distinct purposes in your document should have distinct FrameMaker format names, even if they share the same print format. However, if your document does contain paragraphs with the same format name that need different CSS classes, you can use Code markers to flag those paragraphs, and assign a different class with a macro.

For example, suppose most of your Heading 2 paragraphs are assigned CSS class Heading2, but a few Heading 2 paragraphs need one of three other classes: About, Configuration, or Procedure. You can surround all Heading 2 paragraphs with code to hold the HTML tags and class assignments:

[HTMLParaStyles]

Heading 2=NoPara CodeBefore CodeAfter

The starting H2 tag assigns a class whose value is computed by macro $UseH2Class:

[ParaStyleCodeBefore]

Heading 2=<H2 class="<$UseH2Class>">

The closing H2 tag follows the paragraph:

[ParaStyleCodeAfter]

Heading 2=</H2>

Macro $UseH2Class checks the value of macro variable $$h2class to determine which class to assign:

[UseH2Class]

<$_if ($$h2class is "A")>About\

  <$_elseif ($$h2class is "C")>Configuration\

  <$_elseif ($$h2class is "P")>Procedure\

  <$_else>Heading2\

  <$_endif>

<$$h2class="H">\

Macro variable $$h2class is initialized (and always reset) to a value that results in assigning the default class, Heading2 (via the $_else clause in macro $UseH2Class):

[MacroVariables]

h2class=H

To set $$h2class for a paragraph that needs a non-default class, you would insert a Code marker in the paragraph that precedes each such paragraph. The content of the marker would look like this:

<$$h2class="A">

To assign a non-default class to the very first paragraph in a FrameMaker file, you would have to create a chapter-specific configuration file, filename.ini, for that FrameMaker file, with content (for example):

[MacroVariables]

h2class=A

See §33.1.1 Providing configuration files for individual chapters.

See also:

§28 Working with macros

§29 Working with FrameMaker markers

§33 Overriding configuration settings



22 Setting up CSS for HTML > 22.7 Assigning CSS classes > 22.7.11 Overriding CSS class for selected paragraphs