right-aligned poem line in WL XML
authorJan Szejko <janek37@gmail.com>
Wed, 26 Jul 2017 13:28:37 +0000 (15:28 +0200)
committerJan Szejko <janek37@gmail.com>
Wed, 26 Jul 2017 13:28:37 +0000 (15:28 +0200)
librarian/epub/xsltScheme.xsl
librarian/pdf/wl.cls
librarian/pdf/wl2tex.xslt
librarian/xslt/book2html.xslt
librarian/xslt/book2txt.xslt
librarian/xslt/config.xml
librarian/xslt/normalize.xslt
tests/files/example-wl.xml

index d6f69bb..29966e4 100644 (file)
     &#160;</div>
   </xsl:template>
 
     &#160;</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/>
+    &#160;</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">
index 575f7c4..824ac19 100644 (file)
@@ -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]}}}
index 525b412..f26f62a 100644 (file)
         <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>
                 <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>
index 07588b6..d62071e 100644 (file)
             <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 -->
                     <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>
             <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>
index 322dd74..514d624 100644 (file)
         <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 -->
                 <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>
         <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>
index 4730f4b..113c464 100644 (file)
@@ -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">
index 85a2a65..435c30a 100644 (file)
@@ -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>
 
index 6a06517..945eee5 100644 (file)
@@ -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>