Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
consistently name all p.-lvl. el.s. implemented footnotes.
  • Loading branch information
EsGeh authored and EsGeh committed Mar 25, 2019
1 parent 08c3c24 commit a38cbb2
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 25 deletions.
41 changes: 41 additions & 0 deletions tei2html.xsl
Expand Up @@ -644,6 +644,9 @@
<a class="accordion__showall show" href="#">Close All</a>
<!-- <xsl:call-template name="document-structure"/> -->
<xsl:apply-templates mode="body" select="*[not(name() = 'head')]"/>

<xsl:call-template name="footnotes"/>

<!-- closing elements go here -->
</div>
</section>
Expand Down Expand Up @@ -685,6 +688,44 @@
</xsl:for-each>
</xsl:template>


<xsl:template name="footnotes">
<xsl:variable name="chapter" select="."/>
<div class="accordion__item active">
<a class="accordion__title" href="#">
<h2> Footnotes </h2>
</a>
<div class="accordion__content">
<div class="publication-detail__footnotes">
<ol>
<xsl:for-each select="$chapter//tei:*[name() = $paragraph_elements]">
<xsl:variable name="paragraph" select="."/>
<xsl:variable name="paragraph_nr">
<xsl:number
count="tei:*[name() = $paragraph_elements]"
from="tei:div[@type = 'chapter']"
level="any"
/>
</xsl:variable>

<xsl:for-each select="$paragraph//tei:note[@place = 'bottom']">
<li id="fn{@n}">
<xsl:for-each select="tei:p">
<p><xsl:apply-templates mode="html"/></p>
</xsl:for-each>
<a href="#p{$paragraph_nr}">to paragraph</a>
</li>
</xsl:for-each>
</xsl:for-each>
</ol>
</div>
<!-- the link to close the accordeon: -->
<a class="accordion__pageup" href="#"></a> <a class="accordion__popap" href="#"></a>
<div class="accordion__popap-eye"></div>
</div>
</div>
</xsl:template>

<xsl:template name="website_meta_tags">
<xsl:param name="citation_title"/>
<xsl:param name="citation_author"/>
Expand Down
75 changes: 50 additions & 25 deletions tei2html_utils/html_rules.xsl
Expand Up @@ -56,12 +56,6 @@
-->
</xsl:template>

<!-- part and chapter headings are already rendered: -->

<!--
<xsl:template match="//tei:div[@type='chapter' or @type='part']/tei:head" mode="body"/>
-->

<!-- section hierarchy -->

<xsl:template match="tei:div[@type='section']" mode="body">
Expand Down Expand Up @@ -104,6 +98,8 @@

<!-- paragraph level elements: -->

<xsl:variable name="paragraph_elements" as="xs:string*" select="('p', 'epigraph', 'ab', 'lg', 'quote', 'list', 'table', 'figure')"/>

<xsl:template match="tei:body//tei:head" mode="body">
<xsl:choose>
<xsl:when test="tei:choice/tei:expan">
Expand All @@ -115,16 +111,23 @@
</xsl:choose>
</xsl:template>

<xsl:template name="paragraph_nr">
<xsl:number
count="tei:*[name() = $paragraph_elements]"
from="tei:div[@type = 'chapter']"
level="any"
/>
</xsl:template>

<xsl:template match="tei:body//tei:p" mode="body">
<xsl:variable name="chapter" select="ancestor::tei:div[@type = 'chapter']"/>
<xsl:variable name="chapter_nr" select="count($chapter/preceding-sibling::*)"/>
<xsl:variable name="paragraph_nr" select="index-of($chapter//tei:p/generate-id(), generate-id(.))"/>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>

<xsl:variable name="local_uri" select="concat($series, '/', $publication_number, '/', $chapter_nr , '/index.html#', $paragraph_nr)"/>
<xsl:variable name="global_uri" select="concat($domain, '/', $local_uri)"/>

<xsl:message>paragraph <xsl:value-of select="$paragraph_nr"/></xsl:message>
<p>
<p id="p{$paragraph_nr}">
<xsl:if test="@corresp">
<xsl:variable name="id" as="xs:string" select="eoa:normalize_reference(@corresp)"/>
<xsl:variable name="theorem" select="key('theoremdecls', $id)"/>
Expand All @@ -149,25 +152,31 @@
<xsl:value-of select="$global_uri"/>
</a>
</div>
<!--
<a name="{$paragraph_nr}">bla2</a>
-->
</xsl:template>

<xsl:template match="tei:epigraph" mode="body">
<!-- TODO: a single grouping element is needed, to carry the paragraph id -->
<xsl:message>epigraph</xsl:message>
<xsl:for-each select="tei:p">
<p>
<em>
<xsl:apply-templates mode="html"/>
</em>
</p>
</xsl:for-each>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<!--
<div id="p{$paragraph_nr}">
-->
<xsl:for-each select="tei:p">
<p>
<em>
<xsl:apply-templates mode="html"/>
</em>
</p>
</xsl:for-each>
<!--
</div>
-->
</xsl:template>

<xsl:template match="tei:ab[@type = 'chapterabstract']" mode="body">
<xsl:message>chapter abstract</xsl:message>
<p>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<p id="p{$paragraph_nr}">
<xsl:apply-templates mode="html"/>
</p>
</xsl:template>
Expand All @@ -179,9 +188,10 @@

<xsl:template match="tei:ab[@type='subequations']" mode="body">
<xsl:message>equation array</xsl:message>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<xsl:element name="table">
<xsl:for-each select="tei:formula">
<tr>
<tr id="p{$paragraph_nr}">
<td>
<xsl:value-of select="concat('$', ., '$')"/>
</td>
Expand All @@ -192,9 +202,10 @@

<xsl:template match="tei:ab[@type='equationarray']" mode="body">
<xsl:message>equation array</xsl:message>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<xsl:element name="table">
<xsl:for-each select="tei:formula">
<tr>
<tr id="p{$paragraph_nr}">
<td>
<xsl:value-of select="concat('$', ., '$')"/>
</td>
Expand All @@ -209,7 +220,8 @@
<xsl:template match="tei:lg[@type='verse']" mode="body">
<!-- TODO: find a way to indent the poem -->
<xsl:message>verse</xsl:message>
<p>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<p id="p{$paragraph_nr}">
<xsl:for-each select="tei:l">
<xsl:apply-templates mode="html"/>
<xsl:if test="position() != last()">
Expand All @@ -219,8 +231,18 @@
</p>
</xsl:template>

<xsl:template match="tei:quote" mode="body">
<!-- TODO: find a way to indent the quote -->
<xsl:message>quote</xsl:message>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<p id="p{$paragraph_nr}">
<xsl:apply-templates mode="html"/>
</p>
</xsl:template>

<xsl:template match="tei:list[@type='ordered' or @type='unordered' or @type='gloss']" mode="body">
<xsl:message>list</xsl:message>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<xsl:variable name="element_name">
<xsl:choose>
<xsl:when test="@type = 'ordered'">ol</xsl:when>
Expand All @@ -232,6 +254,7 @@
</xsl:choose>
</xsl:variable>
<xsl:element name="{$element_name}">
<xsl:attribute name="id" select="$paragraph_nr"/>
<xsl:for-each select="tei:item">
<li>
<xsl:if test="preceding-sibling::tei:label[1]">
Expand All @@ -246,7 +269,8 @@

<xsl:template match="tei:table" mode="body">
<xsl:message>table</xsl:message>
<figure>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<figure id="p{$paragraph_nr}">
<xsl:element name="table">
<xsl:for-each select="tei:row">
<tr>
Expand All @@ -269,10 +293,11 @@
<xsl:template match="tei:figure" mode="body">
<!-- TODO: check/fix path -->
<xsl:message>figure</xsl:message>
<xsl:variable name="paragraph_nr"><xsl:call-template name="paragraph_nr"/></xsl:variable>
<xsl:variable name="caption">
<xsl:apply-templates select="tei:head/node() | text()" mode="html"/>
</xsl:variable>
<figure class="publication__image">
<figure class="publication__image" id="p{$paragraph_nr}">
<a href="{@url}" data-lightbox="" title="$caption">
<img src="{@url}">image could not</img>
</a>
Expand Down

0 comments on commit a38cbb2

Please sign in to comment.