eeditiones / tei-publisher-app

The main TEI Publisher app
https://teipublisher.com
GNU General Public License v3.0
65 stars 32 forks source link

Introduce new mode value for generated HTML version of entities (for annotations) #235

Open daliboris opened 3 weeks ago

daliboris commented 3 weeks ago

I suggest to introduce new mode value (within $parameters variable) to control HTML generated (in the tooltip, for example) for annotated elements.

Suggested parameter's value, for instance register-entry should be used in reapi:register-entry() function in the registers.xql module.

On the line 435 change

"details": <div>{$pm-config:web-transform($entry, map {}, "annotations.odd")}</div>

to

"details": <div>{$pm-config:web-transform($entry, map {"mode" : "register-entry"}, "annotations.odd")}</div>

With this new value you can control how elements in the tooltip are rendered.

If the entity is part of the list (for example list of glosses),

<list type="glossary">
<item xml:id="kalendy">
  <label type="main">Kalendy</label>
  <gloss xml:lang="cs">název prvního dne v měsíci v římském kalendáři. <hi rendition="italic">Jani Calendae </hi>jsou tedy lednové Kalendy, začátek roku.</gloss>
  <gloss xml:lang="en">the name of the first day of the month in the Roman calendar. <hi rendition="italic">Jani Calendae</hi> is thus the January Calendae, the beginning of the year.</gloss>
  <note />
</item>
</list>

the <item> element can be rendered as the block element:

<elementSpec ident="item" mode="change">
    <model predicate="$parameters?mode='register-entry' and parent::list" behaviour="block" />
    <model behaviour="listItem"/>
</elementSpec>

Another example: if the <hi> element is part of the anotation, it can be rendered with desired rendition but not as an annotation:

<elementSpec ident="hi" mode="change">
    <model predicate="$parameters?mode='register-entry'" behaviour="inline" useSourceRendition="true"/> 
    <model behaviour="inline" cssClass="annotation annotation-hi" useSourceRendition="true"/>
</elementSpec>