#### 7.4.8 Assigning content-adding properties to formats

You can use properties start, end, before, and after to add text or code around every instance of a format; and property replace to substitute text or code for each instance. All five apply to text formats; before, after, and replace apply to table formats also.

These properties are not based on CSS, because many current browsers (notably Internet Explorer) do not support the CSS settings required. Therefore, DITA2Go adds the code for these properties directly to HTML output.

The content-adding properties provide alternatives to the corresponding [StyleCode*] sections in your project configuration file. For example:

With a [StyleCode*] section:

    [WordStyles]
    isbn = CodeStart

    [StyleCodeStart]
    isbn = ISBN:

With format properties:

    [isbn]
    start = ISBN:

You can include macros in the content-adding settings; see §37.9.3 Surrounding or replacing text with code or macros. Each setting must either fit all on one line, or reference a macro. Any regular configuration settings in [StyleCode*] sections in your project configuration file, or in a general configuration template, override content-adding properties.

Table 37-10 shows exactly where each added content is placed in output.

Some examples for HTML output:

    [FormatName]
    before = <h3 class="caution">Caution!</h3>
    start = <i>For example: </i>
    end = <$MyEndingMacro>
    after = <hr style="width:50%;"/>

Some examples for RTF output:

    [FormatName]
    before = \\pard \\s<$_stylenum("CautionFormat")> Caution!\\par
    start = {\\i For example:\\~ }
    end = <$MyEndingMacro>
    after = \\pard\\li2880\\ri2880\\brdrb\\brdrw20\\brdrsp120\\par

For RTF content, you can also use the following predefined macros:

<$_style(stylename)> | RTF start code for the paragraph or character format; mainly for setting up title pages with a macro used after the title itself
<$_colornum(colorref)> | Just the color number, used after \\cf or \\cb (foreground or background)
<$_fontnum(fontname)> | Just the font number, used after \\f
<$_stylenum(stylename)> | Just the style number; use it after \\s in your own RTF code
<$_styleref(stylename)> | STYLEREF field with the named style, useful in headers and footers (only)
<$_pageref> | PAGEREF field referencing last bookmark used, for after TOC formats

For example:

    [TOC]
    based = Heading2
    font size = 13pt
    line height = 16pt
    margin top = 8pt
    section = FrontSection
    tabs = dot R3in
    end = \\tab \\~<$_PageRef>

Previous Topic: 7.4.7 Applying CSS and RTF code to output formats

Next Topic: 7.5 Understanding text output formats

Parent Topic: 7.4 Understanding how to define output formats

Sibling Topics:

7.4.1 Naming output formats

7.4.2 Assigning values to format properties

7.4.3 Documenting output formats

7.4.4 Understanding the basis of format properties

7.4.5 Basing format properties on other formats

7.4.6 Modifying DITA2Go default output formats

7.4.7 Applying CSS and RTF code to output formats