Skip to content

Commit

Permalink
navigation entries can be handed via template param
Browse files Browse the repository at this point in the history
  • Loading branch information
EsGeh authored and EsGeh committed Nov 1, 2019
1 parent 8eecec1 commit f1c81d1
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 12 deletions.
36 changes: 31 additions & 5 deletions tei2html/tei2html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:eoa="http://www.edition-open-access.de/ns"
exclude-result-prefixes="xs tei eoa"
version="2.0">
<xsl:output method="html" encoding="UTF-8"/>
version="2.0"
>
<xsl:output
method="html"
encoding="UTF-8"
indent="yes"
/>

<xsl:include href="tei2html_index_utils.xsl"/>
<xsl:include href="tei2html_chapter_utils.xsl"/>
Expand All @@ -16,28 +21,49 @@
<xsl:param name="output_dir" as="xs:string" select="'.'"/>
<xsl:param name="static_dir" as="xs:string" select="'static'"/>
<xsl:param name="logo_dir" as="xs:string" select="concat($static_dir, '/assets/images')"/>
<xsl:param name="nav_items" as="element(eoa:entry)*">
<eoa:entry active="1">
<eoa:link>
<xsl:text>#</xsl:text>
</eoa:link>
<eoa:title>Publications</eoa:title>
</eoa:entry>
</xsl:param>

<!--
<xsl:param name="verbosity" as="xs:integer" required="no" select="0"/>
<xsl:param name="static_dir" as="xs:string" select="'static'"/>
-->

<xsl:template match="/">
<xsl:message> domain: <xsl:value-of select="$domain"/> </xsl:message>
<xsl:variable name="output_subdir" as="xs:string">
<xsl:value-of select="concat($output_dir, '/', $series, '/', $publication_number)"/>
</xsl:variable>
<xsl:result-document method="html" encoding="UTF-8" include-content-type="yes" href="{concat($output_subdir, '/index.html')}">
<xsl:result-document
method="html"
encoding="UTF-8"
include-content-type="yes"
indent="yes"
href="{concat($output_subdir, '/index.html')}"
>
<xsl:call-template name="writeindexfile">
<xsl:with-param name="static_dir" select="concat('../../', $static_dir)"/>
<xsl:with-param name="logo_dir" select="concat('../../', $logo_dir)"/>
<xsl:with-param name="nav_items" as="element(eoa:entry)*" select="$nav_items"/>
</xsl:call-template>
</xsl:result-document>
<xsl:for-each select="//tei:div[@type='chapter']">
<xsl:result-document method="html" encoding="UTF-8" include-content-type="yes" href="{concat($output_subdir, '/', position(), '/index.html')}">
<xsl:result-document
method="html"
encoding="UTF-8"
include-content-type="yes"
indent="yes"
href="{concat($output_subdir, '/', position(), '/index.html')}"
>
<xsl:call-template name="writechapterfile">
<xsl:with-param name="static_dir" select="concat('../../../', $static_dir)"/>
<xsl:with-param name="logo_dir" select="concat('../../../', $logo_dir)"/>
<xsl:with-param name="nav_items" as="element(eoa:entry)*" select="$nav_items"/>
</xsl:call-template>
</xsl:result-document>
</xsl:for-each>
Expand Down
9 changes: 9 additions & 0 deletions tei2html/tei2html_chapter.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

<xsl:param name="static_dir" as="xs:string" select="'static'"/>
<xsl:param name="logo_dir" as="xs:string" select="concat($static_dir, '/assets/images')"/>
<xsl:param name="nav_items" as="element(eoa:entry)*">
<eoa:entry active="1">
<eoa:link>
<xsl:text>#</xsl:text>
</eoa:link>
<eoa:title>Publications</eoa:title>
</eoa:entry>
</xsl:param>
<xsl:param name="chapter_nr" as="xs:integer" required="1"/>

<xsl:output method="html" encoding="UTF-8"/>
Expand All @@ -26,6 +34,7 @@
<xsl:call-template name="writechapterfile">
<xsl:with-param name="static_dir" select="$static_dir"/>
<xsl:with-param name="logo_dir" select="$logo_dir"/>
<xsl:with-param name="nav_items" as="element(eoa:entry)*" select="$nav_items"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
Expand Down
9 changes: 5 additions & 4 deletions tei2html/tei2html_chapter_utils.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:eoa="http://www.edition-open-access.de/ns"
exclude-result-prefixes="xs tei eoa"
version="2.0">
version="2.0"
>
<xsl:output method="html" encoding="UTF-8"/>

<!-- use-character-maps="texreplacements"/>-->
Expand All @@ -24,9 +25,8 @@
<xsl:template name="writechapterfile">
<xsl:param name="static_dir" as="xs:string"/>
<xsl:param name="logo_dir" as="xs:string"/>
<!--
<xsl:param name="chapter_nr" as="xs:integer"/>
-->
<xsl:param name="nav_items" as="element(eoa:entry)*"/>

<xsl:call-template name="website_template">
<xsl:with-param name="title">
<xsl:call-template name="chapter_title"/>
Expand All @@ -37,6 +37,7 @@
<!-- TODO: replace by "text logo" -->
<xsl:value-of select="concat($logo_dir, '/logo.png')"/>
</xsl:with-param>
<xsl:with-param name="nav_items" as="element(eoa:entry)*" select="$nav_items"/>
<xsl:with-param name="meta_tags">
<xsl:call-template name="website_meta_tags">
<xsl:with-param name="citation_title">
Expand Down
9 changes: 9 additions & 0 deletions tei2html/tei2html_index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@

<xsl:param name="static_dir" as="xs:string" select="'static'"/>
<xsl:param name="logo_dir" as="xs:string" select="concat($static_dir, '/assets/images')"/>
<xsl:param name="nav_items" as="element(eoa:entry)*">
<eoa:entry active="1">
<eoa:link>
<xsl:text>#</xsl:text>
</eoa:link>
<eoa:title>Publications</eoa:title>
</eoa:entry>
</xsl:param>

<xsl:include href="utils/common.xsl"/>
<xsl:include href="utils/html_rules.xsl"/>
Expand All @@ -31,6 +39,7 @@
<xsl:call-template name="writeindexfile">
<xsl:with-param name="static_dir" select="$static_dir"/>
<xsl:with-param name="logo_dir" select="$logo_dir"/>
<xsl:with-param name="nav_items" as="element(eoa:entry)*" select="$nav_items"/>
</xsl:call-template>
</xsl:template>

Expand Down
2 changes: 2 additions & 0 deletions tei2html/tei2html_index_utils.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<xsl:template name="writeindexfile">
<xsl:param name="static_dir" as="xs:string"/>
<xsl:param name="logo_dir" as="xs:string"/>
<xsl:param name="nav_items" as="element(eoa:entry)*"/>
<xsl:call-template name="website_template">
<xsl:with-param name="static_dir" select="$static_dir"/>
<xsl:with-param name="title">
Expand All @@ -30,6 +31,7 @@
<!-- TODO: replace by "text logo" -->
<xsl:value-of select="concat($logo_dir, '/logo.png')"/>
</xsl:with-param>
<xsl:with-param name="nav_items" as="element(eoa:entry)*" select="$nav_items"/>
<xsl:with-param name="meta_tags">
<xsl:call-template name="website_meta_tags">
<xsl:with-param name="citation_title">
Expand Down
8 changes: 7 additions & 1 deletion tei2html/utils/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:eoa="http://www.edition-open-access.de/ns"
exclude-result-prefixes="xs tei eoa"
version="2.0">
version="2.0"
>
<xsl:output
method="html"
encoding="UTF-8"
indent="yes"
/>

<xsl:param name="verbosity" as="xs:integer" required="no" select="0"/>

Expand Down
9 changes: 7 additions & 2 deletions tei2html/utils/html_rules.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:eoa="http://www.edition-open-access.de/ns"
exclude-result-prefixes="xs tei eoa"
version="2.0">
<xsl:output method="html" encoding="UTF-8"/>
version="2.0"
>
<xsl:output
method="html"
encoding="UTF-8"
indent="yes"
/>

<xsl:key name="theoremdecls" match="tei:ab[@type = 'theoremdeclaration']" use="@xml:id"/>
<xsl:key name="theorems" match="tei:p[@corresp]" use="eoa:normalize_reference(@corresp)"/>
Expand Down

0 comments on commit f1c81d1

Please sign in to comment.