fnp
/
librarian.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9c6bd78
)
right-aligned poem line in WL XML
author
Jan Szejko
<janek37@gmail.com>
Wed, 26 Jul 2017 13:28:37 +0000
(15:28 +0200)
committer
Jan Szejko
<janek37@gmail.com>
Wed, 26 Jul 2017 13:28:37 +0000
(15:28 +0200)
librarian/epub/xsltScheme.xsl
patch
|
blob
|
history
librarian/pdf/wl.cls
patch
|
blob
|
history
librarian/pdf/wl2tex.xslt
patch
|
blob
|
history
librarian/xslt/book2html.xslt
patch
|
blob
|
history
librarian/xslt/book2txt.xslt
patch
|
blob
|
history
librarian/xslt/config.xml
patch
|
blob
|
history
librarian/xslt/normalize.xslt
patch
|
blob
|
history
tests/files/example-wl.xml
patch
|
blob
|
history
diff --git
a/librarian/epub/xsltScheme.xsl
b/librarian/epub/xsltScheme.xsl
index
d6f69bb
..
29966e4
100644
(file)
--- a/
librarian/epub/xsltScheme.xsl
+++ b/
librarian/epub/xsltScheme.xsl
@@
-207,6
+207,12
@@
 </div>
</xsl:template>
 </div>
</xsl:template>
+ <xsl:template match="wers_do_prawej">
+ <div class="verse" style='text-align: right;' xmlns="http://www.w3.org/1999/xhtml">
+ <xsl:apply-templates/>
+  </div>
+ </xsl:template>
+
<xsl:template match="wers_wciety[@typ!='']">
<div class="verse" xmlns="http://www.w3.org/1999/xhtml">
<xsl:attribute name="style">
<xsl:template match="wers_wciety[@typ!='']">
<div class="verse" xmlns="http://www.w3.org/1999/xhtml">
<xsl:attribute name="style">
diff --git
a/librarian/pdf/wl.cls
b/librarian/pdf/wl.cls
index
575f7c4
..
824ac19
100644
(file)
--- a/
librarian/pdf/wl.cls
+++ b/
librarian/pdf/wl.cls
@@
-500,6
+500,9
@@
Letters={Uppercase}
\newcommand{\werswciety}[2][1em]{%
\Nw\hspace*{#1}#2%
}
\newcommand{\werswciety}[2][1em]{%
\Nw\hspace*{#1}#2%
}
+\newcommand{\wersdoprawej}[1]{%
+\Nw\hspace*{\fill}#1%
+}
\ifshowfootnotes
\newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
\ifshowfootnotes
\newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
diff --git
a/librarian/pdf/wl2tex.xslt
b/librarian/pdf/wl2tex.xslt
index
525b412
..
f26f62a
100644
(file)
--- a/
librarian/pdf/wl2tex.xslt
+++ b/
librarian/pdf/wl2tex.xslt
@@
-312,7
+312,7
@@
<xsl:when test="count(br) > 0">
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
<xsl:when test="count(br) > 0">
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
- <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
+ <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
][1]" />
</xsl:call-template>
<xsl:for-each select="br">
<TeXML escape="0">\\{}</TeXML>
</xsl:call-template>
<xsl:for-each select="br">
<TeXML escape="0">\\{}</TeXML>
@@
-321,14
+321,14
@@
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
- <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
+ <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
)][1]" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="text() | node()" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="text() | node()" />
- <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
+ <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd
|wers_do_prawej
[1]" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
diff --git
a/librarian/xslt/book2html.xslt
b/librarian/xslt/book2html.xslt
index
07588b6
..
d62071e
100644
(file)
--- a/
librarian/xslt/book2html.xslt
+++ b/
librarian/xslt/book2html.xslt
@@
-200,7
+200,7
@@
<xsl:when test="count(br) > 0">
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
<xsl:when test="count(br) > 0">
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
- <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
+ <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
][1]" />
</xsl:call-template>
<xsl:for-each select="br">
<!-- Each BR tag "consumes" text after it -->
</xsl:call-template>
<xsl:for-each select="br">
<!-- Each BR tag "consumes" text after it -->
@@
-208,14
+208,14
@@
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
- <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
+ <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
)][1]" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="text() | node()" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="text() | node()" />
- <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
+ <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd
|wers_do_prawej
[1]" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
@@
-243,6
+243,9
@@
<xsl:when test="name($verse-type) = 'wers_cd'">
<xsl:attribute name="style">padding-left: 12em</xsl:attribute>
</xsl:when>
<xsl:when test="name($verse-type) = 'wers_cd'">
<xsl:attribute name="style">padding-left: 12em</xsl:attribute>
</xsl:when>
+ <xsl:when test="name($verse-type) = 'wers_do_prawej'">
+ <xsl:attribute name="style">text-align: right</xsl:attribute>
+ </xsl:when>
</xsl:choose>
<xsl:apply-templates select="$verse-content" mode="inline" />
</p>
</xsl:choose>
<xsl:apply-templates select="$verse-content" mode="inline" />
</p>
diff --git
a/librarian/xslt/book2txt.xslt
b/librarian/xslt/book2txt.xslt
index
322dd74
..
514d624
100644
(file)
--- a/
librarian/xslt/book2txt.xslt
+++ b/
librarian/xslt/book2txt.xslt
@@
-180,7
+180,7
@@
<xsl:when test="count(br) > 0">
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
<xsl:when test="count(br) > 0">
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
- <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
+ <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
][1]" />
</xsl:call-template>
<xsl:for-each select="br">
<!-- Each BR tag "consumes" text after it -->
</xsl:call-template>
<xsl:for-each select="br">
<!-- Each BR tag "consumes" text after it -->
@@
-188,14
+188,14
@@
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
- <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
+ <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
)][1]" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="text() | node()" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="text() | node()" />
- <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
+ <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd
|wers_do_prawej
[1]" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
@@
-226,6
+226,9
@@
<xsl:when test="name($verse-type) = 'wers_cd'">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="name($verse-type) = 'wers_cd'">
<xsl:text> </xsl:text>
</xsl:when>
+ <xsl:when test="name($verse-type) = 'wers_do_prawej'">
+ <xsl:text> </xsl:text>
+ </xsl:when>
</xsl:choose>
<xsl:value-of select="wl:strip($content)" />
</xsl:template>
</xsl:choose>
<xsl:value-of select="wl:strip($content)" />
</xsl:template>
diff --git
a/librarian/xslt/config.xml
b/librarian/xslt/config.xml
index
4730f4b
..
113c464
100644
(file)
--- a/
librarian/xslt/config.xml
+++ b/
librarian/xslt/config.xml
@@
-49,6
+49,7
@@
<wers_cd />
<wers_akap />
<wers_wciety />
<wers_cd />
<wers_akap />
<wers_wciety />
+ <wers_do_prawej />
</paragraph-elements>
<header-1-elements element="h1" mixed="true">
</paragraph-elements>
<header-1-elements element="h1" mixed="true">
diff --git
a/librarian/xslt/normalize.xslt
b/librarian/xslt/normalize.xslt
index
85a2a65
..
435c30a
100644
(file)
--- a/
librarian/xslt/normalize.xslt
+++ b/
librarian/xslt/normalize.xslt
@@
-51,7
+51,7
@@
<!-- First, collect all the tags up to first BR -->
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::node()" />
<!-- First, collect all the tags up to first BR -->
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="br[1]/preceding-sibling::node()" />
- <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
+ <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
][1]" />
</xsl:call-template>
<!-- Collect the rest of verses -->
</xsl:call-template>
<!-- Collect the rest of verses -->
@@
-61,7
+61,7
@@
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::node()[count(preceding-sibling::br) = $lnum+1 and name() != 'br']" />
<xsl:call-template name="verse">
<xsl:with-param name="verse-content"
select="following-sibling::node()[count(preceding-sibling::br) = $lnum+1 and name() != 'br']" />
- <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
+ <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'
or name() = 'wers_do_prawej'
)][1]" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
@@
-70,7
+70,7
@@
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="child::node()" />
<xsl:otherwise>
<xsl:call-template name="verse">
<xsl:with-param name="verse-content" select="child::node()" />
- <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
+ <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd
|wers_do_prawej
[1]" />
</xsl:call-template>
</xsl:otherwise>
</xsl:call-template>
</xsl:otherwise>
diff --git
a/tests/files/example-wl.xml
b/tests/files/example-wl.xml
index
6a06517
..
945eee5
100644
(file)
--- a/
tests/files/example-wl.xml
+++ b/
tests/files/example-wl.xml
@@
-83,6
+83,7
@@
autor_utworu, dzielo_nadrzedne, nazwa_utworu, podtytul, tłumacz (z DC)]</akap>
<wers_wciety typ="4">wers_wciety@typ=4</wers_wciety>/
<wers_wciety typ="5">wers_wciety@typ=5</wers_wciety>/
<wers_wciety typ="6">wers_wciety@typ=6</wers_wciety>/
<wers_wciety typ="4">wers_wciety@typ=4</wers_wciety>/
<wers_wciety typ="5">wers_wciety@typ=5</wers_wciety>/
<wers_wciety typ="6">wers_wciety@typ=6</wers_wciety>/
+<wers_do_prawej>wers do prawej</wers_do_prawej>/
<wers_cd>wers_cd</wers_cd>/
<zastepnik_wersu />. . . . . . . . . . . . . . . .
</strofa>
<wers_cd>wers_cd</wers_cd>/
<zastepnik_wersu />. . . . . . . . . . . . . . . .
</strofa>