X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/6d65ed2b0c5f9f6df14de211ea2bf1de0a5dac70..1428a9d8f91b754fe7f9fb96cbdd0d6a2536ffc1:/librarian/xslt/book2html.xslt?ds=sidebyside diff --git a/librarian/xslt/book2html.xslt b/librarian/xslt/book2html.xslt old mode 100755 new mode 100644 index 0f9b665..81e865b --- a/librarian/xslt/book2html.xslt +++ b/librarian/xslt/book2html.xslt @@ -6,9 +6,11 @@ --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:wl="http://wolnelektury.pl/functions" > + xmlns:wl="http://wolnelektury.pl/functions" + xmlns:dc="http://purl.org/dc/elements/1.1/" > <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration = "yes" version="2.0" /> +<xsl:strip-space elements="opowiadanie powiesc dramat_wierszowany_l dramat_wierszowany_lp dramat_wspolczesny liryka_l liryka_lp wywiad"/> <xsl:template match="utwor"> <xsl:choose> <xsl:when test="@full-page"> @@ -100,7 +102,7 @@ } - #toc, #themes, #nota_red { + #toc, #themes, #nota_red, #info { position: fixed; left: 0em; top: 1.5em; @@ -148,6 +150,11 @@ position: inherit; } + #info p { + text-align: justify; + margin: 1.5em 0 0; + } + /* =================================================== */ /* = Common elements: headings, paragraphs and lines = */ /* =================================================== */ @@ -285,6 +292,13 @@ margin-top: -0.25em; } + span.translator { + font-size: 0.375em; + display: block; + line-height: 1.5em; + margin-top: 0.25em; + } + div.didaskalia { font-style: italic; margin: 0.5em 0 0 1.5em; @@ -403,7 +417,9 @@ <a href="{concat('#anchor-', generate-id(.))}" class="annotation">[<xsl:number value="count(preceding::*[self::pa or self::pe or self::pr or self::pt]) + 1" />]</a> <xsl:choose> <xsl:when test="count(akap|akap_cd|strofa) = 0"> - <p><xsl:apply-templates select="text()|*" mode="inline" /></p> + <p><xsl:apply-templates select="text()|*" mode="inline" /> + <xsl:if test="name()='pa'"> [przypis autorski]</xsl:if> + </p> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="text()|*" mode="inline" /> @@ -426,6 +442,7 @@ <xsl:if test="nazwa_utworu"> <h1> <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul" mode="header" /> + <xsl:call-template name="translators" /> </h1> </xsl:if> <xsl:apply-templates /> @@ -491,23 +508,28 @@ <!-- Section headers (included in index)--> <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul"> + <xsl:call-template name="section-anchor"/> <h2><xsl:apply-templates mode="inline" /></h2> </xsl:template> <xsl:template match="naglowek_scena|naglowek_rozdzial"> + <xsl:call-template name="section-anchor"/> <h3><xsl:apply-templates mode="inline" /></h3> </xsl:template> <xsl:template match="naglowek_osoba|naglowek_podrozdzial"> + <xsl:call-template name="section-anchor"/> <h4><xsl:apply-templates mode="inline" /></h4> </xsl:template> <!-- Other paragraph tags --> <xsl:template match="miejsce_czas"> + <xsl:call-template name="section-anchor"/> <p class="place-and-time"><xsl:apply-templates mode="inline" /></p> </xsl:template> <xsl:template match="didaskalia"> + <xsl:call-template name="section-anchor"/> <div class="didaskalia"><xsl:apply-templates mode="inline" /></div> </xsl:template> @@ -516,11 +538,15 @@ </xsl:template> <xsl:template match="akap|akap_dialog|akap_cd"> - <p class="paragraph"><xsl:apply-templates mode="inline" /></p> + <p class="paragraph"> + <xsl:call-template name="section-anchor"/> + <xsl:apply-templates mode="inline" /> + </p> </xsl:template> <xsl:template match="strofa"> <div class="stanza"> + <xsl:call-template name="section-anchor"/> <xsl:choose> <xsl:when test="count(br) > 0"> <xsl:call-template name="verse"> @@ -662,6 +688,23 @@ </xsl:template> +<xsl:template name="translators"> + <xsl:if test="//dc:contributor.translator"> + <span class="translator"> + <xsl:text>tÅum. </xsl:text> + <xsl:for-each select="//dc:contributor.translator"> + <xsl:if test="position() != 1">, </xsl:if> + <xsl:apply-templates mode="person" /> + </xsl:for-each> + </span> + </xsl:if> +</xsl:template> + +<xsl:template match="text()" mode="person"> + <xsl:value-of select="wl:person_name(.)" /> +</xsl:template> + + <!-- ================ --> <!-- = IGNORED TAGS = --> <!-- ================ --> @@ -678,5 +721,19 @@ <xsl:value-of select="wl:substitute_entities(.)" /> </xsl:template> +<!-- ========= --> +<!-- = utils = --> +<!-- ========= --> +<xsl:template name="section-anchor"> + <!-- + this formula works as follows: + - get all ancestors including self + - choose the header (third one from root): utwor/book-type/header + - get all preceding siblings + - count them + - create an <a name="sec123"/> tag. + --> + <a name="{concat('sec', count(ancestor-or-self::*[last()-2]/preceding-sibling::*) + 1)}" /> +</xsl:template> -</xsl:stylesheet> \ No newline at end of file +</xsl:stylesheet>