6.4.4 Mapping the same element to different formats

Suppose you want to eliminate an indent from the format for a given block element when that element occurs within a table. For example, when a simple list is nested in a <table> cell or even a <simpletable> cell, you might want to override the indent for the SimpleListItem format. This format is assigned by default to <sli> via an element path defined in file %OMSYSHOME%\d2g\system\config\d2g_config.ini:

[BlockFormatMaps]
sli/sl/* = SimpleListItem

For HTML output, format SimpleListItem is defined in %OMSYSHOME%\d2g\system\formats\d2htm_formats.ini:

[SimpleListItem]
based = Body
margin top = 2pt
margin bottom = 0pt
margin left = 12pt
list style = none
list level = 1

In %OMSYSHOME%\d2g\local\formats\local_d2htm_formats.ini you can define an alternate format, based on [SimpleListItem]:

[SimpleTableListItem]
based = SimpleListItem
margin left = 0pt

Then in your project configuration file you can include alternate element paths for <sli>:

[BlockFormatMaps]
; This mapping handles a simple list in a table cell:
sli/sl/entry/* = SimpleTableListItem
; This mapping handles a simple list in a simpletable cell:
sli/sl/stentry/* = SimpleTableListItem

Depending on the complexity of nested lists in your document, you might need to provide additional override formats for alternate element paths that start with <sli>.

Previous Topic:  6.4.3 Overriding element paths for default formats

Next Topic:  6.4.5 Filtering out elements via format mapping

Parent Topic:  6.4 Mapping element paths to output formats

Sibling Topics:

6.4.1 Understanding element paths

6.4.2 Mapping block and inline element paths to formats

6.4.3 Overriding element paths for default formats

6.4.5 Filtering out elements via format mapping