Skip to content

Commit

Permalink
Insert schema version into HTML documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cmil committed Dec 25, 2024
1 parent b0b6e5f commit ec9f5c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ if [ ! -d $BIN ]; then
git submodule update
fi

version=$(git describe --tags --dirty --always | sed s/^v// | sed s/-g/-/)

mkdir -p dist

# Generate full ODD
Expand All @@ -21,4 +23,5 @@ $BIN/teitohtml --odd dist/dracor.odd.tmp dist/dracor.html.tmp
java -jar Stylesheets/lib/saxon10he.jar \
-xsl:html.xsl \
-s:dist/dracor.html.tmp \
version=$version \
> dist/dracor.html
16 changes: 16 additions & 0 deletions html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ TEI Stylesheets.

<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes" indent="no"/>

<xsl:param name="version"/>

<xsl:variable name="ids" select="//h:ul[@id='dracor-tei-elements']/h:li/h:a/@href/substring-after(., '#')"/>

<xsl:template match="@*|*|processing-instruction()|comment()|node()">
Expand All @@ -35,6 +37,20 @@ TEI Stylesheets.
</xsl:copy>
</xsl:template>

<!-- insert version -->
<xsl:template match="h:div[@class = 'titlePage']">
<xsl:copy>
<xsl:apply-templates select="@*|*"/>
<xsl:if test="$version">
<div class="dracor-schema-version">
<small>
<xsl:value-of select="$version"/>
</small>
</div>
</xsl:if>
</xsl:copy>
</xsl:template>

<!-- add note and link to TEI documentation for non-DraCor elements -->
<xsl:template match="h:h3" mode="non-dracor">
<xsl:variable name="ref" select="substring-after(parent::h:div[@class = 'refdoc']/@id, 'TEI.')"/>
Expand Down

0 comments on commit ec9f5c2

Please sign in to comment.