copy logo.eps
[librarian.git] / librarian / pdf / wl2tex.xslt
index 5a49a01..ebd6a6b 100644 (file)
 <xsl:template match="utwor">
     <TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
         <TeXML escape="0">
-        \documentclass[a4paper, oneside, 11pt]{book}
-        \usepackage{wl}
+        \documentclass[<xsl:value-of select="@customizations"/>]{wl}
+
+        <!-- flags and values set on root -->
+
+        \newif\ifflaglessadvertising
+        <xsl:for-each select="@*[starts-with(name(), 'flag-')]">
+            <cmd>
+                <xsl:attribute name="name"><xsl:value-of select="wl:texcommand(name())" />true</xsl:attribute>
+            </cmd>
+        </xsl:for-each>
+
+        <xsl:for-each select="@*[starts-with(name(), 'data-')]">
+            <TeXML escape="0">
+                \def\<xsl:value-of select="wl:texcommand(name())" />{<TeXML escape="1"><xsl:value-of select="."/></TeXML>}
+            </TeXML>
+        </xsl:for-each>
         </TeXML>
 
         <xsl:choose>
         <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='titlepage' />
 
         <env name="document">
-            <cmd name="maketitle" />
-
-            <cmd name="tytul"><parm>
+            <TeXML escape="0">
+                \def\thankyou{%
+                <xsl:choose>
+                <xsl:when test="//dc:contributor">Thank you for your contribution, <xsl:value-of select="//dc:contributor"/>!</xsl:when>
+                <xsl:otherwise>Thank you for all your contributions!</xsl:otherwise>
+                </xsl:choose>
+                }
+            </TeXML>
+
+            <xsl:if test="@data-cover-width">
+                <cmd name="makecover">
+                    <parm>210mm</parm>
+                    <parm><xsl:value-of select="210 * @data-cover-height div @data-cover-width" />mm</parm>
+                </cmd>
+            </xsl:if>
+            <!--cmd name="maketitle" /-->
+
+            <!--cmd name="tytul"><parm>
               <xsl:choose>
                 <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
-                    <!-- title in master -->
+                    <!- title in master ->
                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/autor_utworu" mode="title" />
                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/dzielo_nadrzedne" mode="title" />
                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu" mode="title" />
                     <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/podtytul" mode="title" />
-                    <!-- dc in master or not -->
+                    <!- dc in master or not ->
                     <cmd name="translatorsline" />
                 </xsl:when>
                 <xsl:otherwise>
-                    <!-- look for author title in dc -->
+                    <!- look for author title in dc ->
                     <xsl:apply-templates select="rdf:RDF" mode="firstdctitle" />
                     <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='firstdctitle' />
                 </xsl:otherwise>
               </xsl:choose>
-            </parm></cmd>
+            </parm></cmd-->
+
+            <TeXML escape="0">
+                \def\coverby{
+                <xsl:if test="@data-cover-by">Cover image:
+                    <xsl:choose>
+                    <xsl:when test="@data-cover-source">
+                        \href{\datacoversource}{\datacoverby}.
+                    </xsl:when>
+                    <xsl:otherwise>
+                        \datacoverby{}.
+                    </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:if>
+                }
+            </TeXML>
+
+            <cmd name="editorialsection" />
+
             <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
             <xsl:apply-templates select="utwor" mode="part" />
-            <cmd name="editorialsection" />
         </env>
     </TeXML>
 </xsl:template>
 
 <xsl:template match="utwor" mode="part">
+    <cmd name="newpage" />
     <cmd name="tytul"><parm>
+
+    <!-- Dirty! -->
+    <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/motyw" mode="inline"/>
+
       <xsl:choose>
         <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
             <!-- title in master -->
+            <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/dzielo_nadrzedne" mode="title" />
+            <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/autor_utworu" mode="title" />
             <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu" mode="title" />
             <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/podtytul" mode="title" />
         </xsl:when>
     <TeXML escape="0">
         \def\authors{<xsl:call-template name="authors" />}
         \author{\authors}
-        \title{<xsl:apply-templates select=".//dc:title" />}
+        \title{<xsl:apply-templates select=".//dc:title" mode="inline" />}
         \def\translatorsline{<xsl:call-template name="translators" />}
 
         \def\bookurl{<xsl:value-of select=".//dc:identifier.url" />}
             \href{http://creativecommons.org/licenses/by-sa/3.0/}{Creative Commons
             Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL}.}
         <xsl:if test=".//dc:rights.license">
-            \def\rightsinfo{Ten utwór jest udostepniony na licencji
+            \def\rightsinfo{This book is available under the terms of
             \href{<xsl:value-of select=".//dc:rights.license" />}{<xsl:value-of select=".//dc:rights" />}.}
         </xsl:if>
 
     </cmd>
 </xsl:template>
 
+<xsl:template match="ilustr">
+    <cmd>
+        <xsl:attribute name="name">
+            <xsl:value-of select="wl:texcommand(name())" />
+        </xsl:attribute>
+               <parm><xsl:value-of select="@src" /></parm>
+        <parm><xsl:apply-templates mode="inline" /></parm>
+    </cmd>
+</xsl:template>
+
+<xsl:template match="@*|node()" mode="identity">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()" mode="identity"/>
+  </xsl:copy>
+</xsl:template>
+
+
+
+<xsl:template match="dmath">
+  <dmath>
+    <xsl:apply-templates mode="identity"/>
+  </dmath>
+</xsl:template>
+
+<xsl:template match="math" mode="inline">
+  <math>
+    <xsl:apply-templates mode="identity"/>
+  </math>
+</xsl:template>
+
+<xsl:template match="table">
+    <xsl:if test="@caption">
+        <group><cmd name="Large"/><xsl:value-of select="@caption"/></group><cmd name="newline"/>
+    </xsl:if>
+    <env name="tabular">
+        <parm><xsl:value-of select="@spec"/></parm>
+        <xsl:apply-templates />
+    </env>
+</xsl:template>
+
+<xsl:template match="r">
+    <xsl:apply-templates />
+    <spec cat="esc"/>
+    <spec cat="esc"/>
+</xsl:template>
+<xsl:template match="c">
+    <xsl:apply-templates mode="inline"/>
+    <xsl:if test="position() &lt; last()-1">
+    <spec cat="align"/>
+    </xsl:if>
+</xsl:template>
+<xsl:template match="hr">
+  <cmd name="hline"/>
+</xsl:template>
 
 <!-- ================ -->
 <!-- = SPECIAL TAGS = -->
 </xsl:template>
 
 <xsl:template name="editors">
-    <xsl:if test="//dc:contributor.editor_parsed|//dc:contributor.technical_editor_parsed">
-        <xsl:text>Opracowanie redakcyjne i przypisy: </xsl:text>
-        <xsl:for-each select="//dc:contributor.editor_parsed|//dc:contributor.technical_editor_parsed[not(//dc:contributor.editor_parsed/text()=text())]">
-            <xsl:sort select="@sortkey" />
+    <xsl:if test=".//dc:contributor.editor_parsed|.//dc:contributor.technical_editor_parsed">
+        <xsl:text>Technical editors: </xsl:text>
+        <xsl:for-each select=".//dc:contributor.editor_parsed|.//dc:contributor.technical_editor_parsed[not(.//dc:contributor.editor_parsed/text()=text())]">
+            <!--xsl:sort select="@sortkey" /-->
             <xsl:if test="position() != 1">, </xsl:if>
             <xsl:apply-templates mode="inline" />
         </xsl:for-each>.
 </xsl:template>
 
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>