##### 27.8.3.1 Assigning replacement code

In the [ExtrReplace] section you can assign HTML code, including macros, to the ExtrStart format or ExtrStart PI marker, whichever you used to designate the start of the extract. The code you assign replaces the entire extract in the parent file. For example:

    [HTMLParaStyles]
    Heading2=ExtrStart

    [ExtrReplace]
    ; doc format = HTML code to use instead of extracted para
    Heading2=<$YourMacroForTheReplacement>

If you need different replacements for different extracts, you could either use different starting formats, or you could use an ExtrReplace PI marker to specify replacement code for a particular extract; the marker takes precedence over anything you specify in the [ExtrReplace] section.

You can use several predefined macro variables in replacement code to reference the replaced extract file, the extract title, and the first graphic in the extract. Table 27-8 lists the variables you can use in extract replacement code. Also, predefined macro <$_extrthumb> provides a convenient way to include scaled thumbnails of graphics as replacement links; see §27.8.3.2.3 Providing scaled thumbnails.

Table 27-8 Predefined macro variables for extract replacement code

Macro variable | Definition | Reference
    <$$_extrgraph>
| File name, as modified by any value specified for [Graphics]ExtrGraphSuffix, of the first graphic in an extract; use to include a thumbnail of the graphic | 27.8.3.2.2
    <$$_extrgraphclass>
| CSS class name to use in <$_extrthumb> macro | 27.8.3.2.3
    <$$_extrgraphhigh>
| Thumbnail height in pixels, for use in <$_extrthumb> macro | 27.8.3.2.3
    <$$_extrgraphtarget>
| target attribute for window used by <$_extrthumb> | 27.8.3.2.3
    <$$_extrgraphid>
| DITA2Go internal name of the first graphic in an extract; use to reference properties | 27.8.3.3
    <$$_extrgraphwide>
| Thumbnail width in pixels, for use in <$_extrthumb> macro | 27.8.3.2.3
    <$$_extrfile>
| Extract file name | 27.8.3.3
    <$$_extrtitle>
| Extract title | 27.8.3.3

For example, the following code uses a thumbnail graphic to link to an extract:

    [HTMLParaStyles]
    FigCaption=Contents ExtrStart Title
    FigAnchor=ExtrFinish

    [ExtrReplace]
    FigCaption=<$ThumbCode>

    [ThumbCode]
    <p class="thumbnail"><a href="<$$_extrfile>">
      <img src="<$$_extrgraph>" alt="<$$_extrtitle>" /></a></p>

See §27.8.3.2 Using thumbnails for links to illustrations in HTML.

Previous Topic: 27.8.3 Replacing extracts with links in the parent file

Next Topic: 27.8.3.2 Using thumbnails for links to illustrations in HTML

Parent Topic: 27.8.3 Replacing extracts with links in the parent file

Sibling Topics:

27.8.3.2 Using thumbnails for links to illustrations in HTML

27.8.3.3 Supplying properties for extracted graphics

Table of Contents • Index