#### 18.7.3.1 Assigning replacement code

In the [ExtrReplace] section you can assign HTML code, including macros, to the ExtrStart format or ExtrStart 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 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 18-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 §18.7.3.2.3 Providing scaled thumbnails.

Table 18-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 | 18.7.3.2.2
<$$_extrgraphclass> | CSS class name to use in <$_extrthumb> macro | 18.7.3.2.3
<$$_extrgraphhigh> | Thumbnail height in pixels, for use in <$_extrthumb> macro | 18.7.3.2.3
<$$_extrgraphtarget> | target attribute for window used by <$_extrthumb> | 18.7.3.2.3
<$$_extrgraphid> | Mif2Go internal name of the first graphic in an extract; use to reference properties | 18.7.3.3
<$$_extrgraphwide> | Thumbnail width in pixels, for use in <$_extrthumb> macro | 18.7.3.2.3
<$$_extrfile> | Extract file name | 18.7.3.3
<$$_extrtitle> | Extract title | 18.7.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 §18.7.3.2 Using thumbnails for links to illustrations in HTML.

| 18.7.3 Replacing extracts with links in the parent file |  | 18.7.3.2 Using thumbnails for links to illustrations in HTML |