Skip to content

Commit

Permalink
tei2html: refactored footer, fixed logo_dir handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
EsGeh authored and EsGeh committed Nov 1, 2019
1 parent 163999d commit 8eecec1
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 35 deletions.
4 changes: 4 additions & 0 deletions tei2html/tei2html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<xsl:include href="utils/common.xsl"/>

<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="verbosity" as="xs:integer" required="no" select="0"/>
Expand All @@ -28,12 +30,14 @@
<xsl:result-document method="html" encoding="UTF-8" include-content-type="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: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: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:call-template>
</xsl:result-document>
</xsl:for-each>
Expand Down
3 changes: 3 additions & 0 deletions tei2html/tei2html_chapter.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
exclude-result-prefixes="xs tei eoa"
version="2.0">

<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="chapter_nr" as="xs:integer" required="1"/>

<xsl:output method="html" encoding="UTF-8"/>
Expand All @@ -23,6 +25,7 @@
<xsl:message>printing chapter <xsl:value-of select="$chapter_nr"/>. head: <xsl:value-of select="tei:head"/></xsl:message>
<xsl:call-template name="writechapterfile">
<xsl:with-param name="static_dir" select="$static_dir"/>
<xsl:with-param name="logo_dir" select="$logo_dir"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
Expand Down
30 changes: 16 additions & 14 deletions tei2html/tei2html_chapter_utils.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@
<!-- context: //tei:div[@type='chapter'] -->
<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:call-template name="website_template">
<xsl:with-param name="title">
<xsl:call-template name="chapter_title"/>
</xsl:with-param>
<xsl:with-param name="platform_name">Edition Open Access</xsl:with-param>
<xsl:with-param name="platform_link">http://edition-open-access.de</xsl:with-param>
<xsl:with-param name="platform_logo">
<!-- TODO: replace by "text logo" -->
<xsl:value-of select="concat($logo_dir, '/logo.png')"/>
</xsl:with-param>
<xsl:with-param name="meta_tags">
<xsl:call-template name="website_meta_tags">
<xsl:with-param name="citation_title">
Expand Down Expand Up @@ -174,20 +181,15 @@
</div>
</main>
</xsl:with-param>
<xsl:with-param name="footer">
<footer class="footer">
<div class="footer__content">
<div class="footer-menu">
<a href="/imprint.html">Imprint &amp; Contact</a>
<a href="/technical.html">Technical Information</a>
</div>
<div class="footer-logo">
<a class="footer-logo__link" href="http://edition-open-access.de" target="_blank">
<img class="logo logo--text" src="{concat($logo_dir, '/logo-text.svg')}" alt="Edition Open Access"/>
</a>
</div>
</div>
</footer>
<xsl:with-param name="footer_items" as="element(eoa:entry)*">
<eoa:entry>
<eoa:link><xsl:text>/imprint.html</xsl:text></eoa:link>
<eoa:title>Imprint &amp; Contact</eoa:title>
</eoa:entry>
<eoa:entry>
<eoa:link><xsl:text>/technical.html</xsl:text></eoa:link>
<eoa:title>Technical Information</eoa:title>
</eoa:entry>
</xsl:with-param>
<xsl:with-param name="script">
<xsl:if test=".//tei:formula">
Expand Down
4 changes: 4 additions & 0 deletions tei2html/tei2html_index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
version="2.0">
<xsl:output method="html" encoding="UTF-8"/>

<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:include href="utils/common.xsl"/>
<xsl:include href="utils/html_rules.xsl"/>
<xsl:include href="tei2html_index_utils.xsl"/>
Expand All @@ -27,6 +30,7 @@
<xsl:template match="/">
<xsl:call-template name="writeindexfile">
<xsl:with-param name="static_dir" select="$static_dir"/>
<xsl:with-param name="logo_dir" select="$logo_dir"/>
</xsl:call-template>
</xsl:template>

Expand Down
31 changes: 16 additions & 15 deletions tei2html/tei2html_index_utils.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@

<xsl:template name="writeindexfile">
<xsl:param name="static_dir" as="xs:string"/>
<xsl:param name="logo_dir" as="xs:string"/>
<xsl:call-template name="website_template">
<xsl:with-param name="static_dir" select="$static_dir"/>
<xsl:with-param name="title">
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
</xsl:with-param>
<xsl:with-param name="platform_name">Edition Open Access</xsl:with-param>
<xsl:with-param name="platform_link">http://edition-open-access.de</xsl:with-param>
<xsl:with-param name="platform_logo">
<!-- TODO: replace by "text logo" -->
<xsl:value-of select="concat($logo_dir, '/logo.png')"/>
</xsl:with-param>
<xsl:with-param name="meta_tags">
<xsl:call-template name="website_meta_tags">
<xsl:with-param name="citation_title">
Expand Down Expand Up @@ -402,21 +409,15 @@
</div>
</main>
</xsl:with-param>
<xsl:with-param name="footer">
<footer class="footer">
<div class="footer__content">
<div class="footer-menu">
<a href="contact.html">Contact</a>
<a href="imprint.html">Imprint</a>
<a class="share" href="#">Share<span>this Page</span></a>
</div>
<div class="footer-logo">
<a class="footer-logo__link" href="http://edition-open-access.de" target="_blank">
<img class="logo logo--text" src="{concat($logo_dir, '/logo-text.svg')}" alt="Edition Open Access"/>
</a>
</div>
</div>
</footer>
<xsl:with-param name="footer_items" as="element(eoa:entry)*">
<eoa:entry>
<eoa:link><xsl:text>/contact.html</xsl:text></eoa:link>
<eoa:title>Contact</eoa:title>
</eoa:entry>
<eoa:entry>
<eoa:link><xsl:text>/imprint.html</xsl:text></eoa:link>
<eoa:title>Imprint</eoa:title>
</eoa:entry>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
Expand Down
57 changes: 51 additions & 6 deletions tei2html/utils/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
version="2.0">

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

<xsl:template name="website_meta_tags">
<xsl:param name="citation_title"/>
Expand All @@ -32,12 +30,17 @@

<xsl:template name="website_template">
<xsl:param name="breadcrumb_items" as="element(eoa:entry)*"/>
<xsl:param name="nav_items" as="element(eoa:entry)*"/>
<xsl:param name="footer_items" as="element(eoa:entry)*"/>
<xsl:param name="platform_name"/>
<xsl:param name="platform_link"/>
<xsl:param name="platform_logo"/>
<xsl:param name="title"/>
<xsl:param name="meta_tags"/>
<xsl:param name="main"/>
<xsl:param name="footer"/>
<xsl:param name="script"/>
<xsl:param name="static_dir"/>
<xsl:param name="logo_dir" as="xs:string" select="concat($static_dir, '/assets/images')"/>
<xsl:param name="breadcrumbs" as="element(eoa:entry)*"/>
<html lang="{//tei:profileDesc/tei:langUsage/tei:language/@ident}">
<head>
Expand All @@ -57,7 +60,7 @@
<div class="blocklogo container">
<div class="blocklogo__logo">
<a href="/index.html">
<img class="blocklogo__img" src="{concat($logo_dir,'/mprl843x495_white.png')}" alt="logo" data-object-fit="cover"/>
<img class="blocklogo__img" src="{concat($logo_dir,'/logo.png')}" alt="logo" data-object-fit="cover"/>
</a>
</div>
</div>
Expand All @@ -70,6 +73,24 @@
<div class="nav__wrapper">
<div class="container">
<ul class="nav__menu">
<xsl:for-each select="$nav_items[self::eoa:entry]">
<xsl:choose>
<xsl:when test="@active">
<li class="nav__item nav__item--active">
<a class="nav__link nav__link--active" href="{eoa:link}">
<xsl:value-of select="eoa:title"/>
</a>
</li>
</xsl:when>
<xsl:otherwise>
<li class="nav__item">
<a class="nav__link" href="{eoa:link}">
<xsl:value-of select="eoa:title"/>
</a>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!--
if we reactivate this, remove the space from '- -'
<li class="nav__item nav__item- -active"><a class="nav__link nav__link- -active" href="./publications.html">Publications</a></li>
Expand All @@ -84,10 +105,15 @@
</form>
</li>
-->
<!-- what's supposed to be that?:
<li class="nav__item nav-footer">
<a class="nav__link nav-footer__link" href="/imprint.html">Imprint &amp; Contact</a>
<a class="nav__link nav-footer__link" href="/technical.html">Technical Information</a>
<xsl:for-each select="$footer_items[self::eoa:entry]">
<a class="nav__link nav-footer__link" href="{eoa:link}">
<xsl:value-of select="eoa:title"/>
</a>
</xsl:for-each>
</li>
-->
</ul>
</div>
</div>
Expand Down Expand Up @@ -116,7 +142,26 @@
</header>
<xsl:copy-of select="$main"/>
</div>
<footer class="footer">
<div class="footer__content">
<div class="footer-menu">
<xsl:for-each select="$footer_items[self::eoa:entry]">
<a href="{eoa:link}">
<xsl:value-of select="eoa:title"/>
</a>
</xsl:for-each>
<a class="share" href="#">Share<span>this Page</span></a>
</div>
<div class="footer-logo">
<a class="footer-logo__link" href="{$platform_link}" target="_blank">
<img class="logo logo--text" src="{$platform_logo}" alt="{$platform_name}"/>
</a>
</div>
</div>
</footer>
<!--
<xsl:copy-of select="$footer"/>
-->
</div>
<script type="text/javascript" src="{concat($static_dir, '/app.js')}"/>
<xsl:copy-of select="$script"/>
Expand Down

0 comments on commit 8eecec1

Please sign in to comment.