Skip to content

Commit

Permalink
ajout d'une valeur data-index (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
emchateau committed Jul 11, 2020
1 parent f3cfa99 commit c841365
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mappings/tei2html.xqm
Expand Up @@ -354,12 +354,22 @@ declare function geogName($node, $options) {
declare function getName($node, $options as map(*)) {
switch($node)
case ($node/tei:forename and $node/tei:surname) return (<span class="smallcaps">{$node/tei:surname/text()}</span>, ', ', $node/tei:forename)
case ($node[fn:local-name(.) = 'persName']) return indexName($node, map{ 'index' : 'nominum'})
case ($node[fn:local-name(.) = 'orgName']) return indexName($node, map{ 'index' : 'nominum'})
case ($node[fn:local-name(.) = 'placeName']) return indexName($node, map{ 'index' : 'locorum'})
case ($node[fn:local-name(.) = 'geoName']) return indexName($node, map{ 'index' : 'locorum'})
case ($node[fn:local-name(.) = 'objectName']) return indexName($node, map{ 'index' : 'operum'})
default return
if ($node/@ref)
then <a class="{$node/fn:name()}" href="{$node/@ref}">{passthru($node, $options)}</a>
else <span class="{$node/fn:name()}">{passthru($node, $options)}</span>
};

declare function indexName($node, $options) {
if ($node/@ref)
then <a class="{fn:local-name($node)}" href="{$node/@ref}" data-index="{$options?index}">{passthru($node, $options)}</a>
else <span class="{fn:local-name($node)}">{passthru($node, $options)}</span>
};
(:~
: this function returns title in an html element
:
Expand Down

0 comments on commit c841365

Please sign in to comment.