remove cut lines
[librarian.git] / librarian / pdf / wl2tex.xslt
index 58be05f..8a31a22 100644 (file)
@@ -15,7 +15,7 @@
 <xsl:template match="utwor">
     <TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
         <TeXML escape="0">
 <xsl:template match="utwor">
     <TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
         <TeXML escape="0">
-        \documentclass[a4paper, oneside, 11pt]{book}
+        \documentclass[<xsl:value-of select="@customizations"/>]{wl}
 
         <!-- flags and values set on root -->
 
 
         <!-- flags and values set on root -->
 
                 \def\<xsl:value-of select="wl:texcommand(name())" />{<TeXML escape="1"><xsl:value-of select="."/></TeXML>}
             </TeXML>
         </xsl:for-each>
                 \def\<xsl:value-of select="wl:texcommand(name())" />{<TeXML escape="1"><xsl:value-of select="."/></TeXML>}
             </TeXML>
         </xsl:for-each>
-
-        \usepackage{wl}
         </TeXML>
 
         <xsl:choose>
             <xsl:when test="@morefloats = 'new'">
                 <TeXML escape="0">
         </TeXML>
 
         <xsl:choose>
             <xsl:when test="@morefloats = 'new'">
                 <TeXML escape="0">
-                    \usepackage[maxfloats=64]{morefloats}
+                    \usepackage[maxfloats=53]{morefloats}
                 </TeXML>
             </xsl:when>
             <xsl:when test="@morefloats = 'old'">
                 </TeXML>
             </xsl:when>
             <xsl:when test="@morefloats = 'old'">
         <env name="document">
             <xsl:if test="@data-cover-width">
                 <cmd name="makecover">
         <env name="document">
             <xsl:if test="@data-cover-width">
                 <cmd name="makecover">
-                    <parm><xsl:value-of select="210 * @data-cover-width div @data-cover-height" />mm</parm>
                     <parm>210mm</parm>
                     <parm>210mm</parm>
+                    <parm><xsl:value-of select="210 * @data-cover-height div @data-cover-width" />mm</parm>
                 </cmd>
             </xsl:if>
                 </cmd>
             </xsl:if>
+                <xsl:if test="@thanks">
+                    <TeXML escape="0">
+                        \def\thanknote{<TeXML escape="1"><xsl:value-of select="@thanks" /></TeXML>}
+                    </TeXML>
+                </xsl:if>
             <cmd name="maketitle" />
 
             <cmd name="tytul"><parm>
             <cmd name="maketitle" />
 
             <cmd name="tytul"><parm>
             </parm></cmd>
             <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" />
             </parm></cmd>
             <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" />
+
+            <TeXML escape="0">
+                <xsl:if test="@data-cover-by">
+                \def\coverby{Okładka na podstawie:
+                    <xsl:choose>
+                    <xsl:when test="@data-cover-source">
+                        \href{\datacoversource}{\datacoverby}
+                    </xsl:when>
+                    <xsl:otherwise>
+                        \datacoverby{}
+                    </xsl:otherwise>
+                    </xsl:choose>
+                }
+                </xsl:if>
+                \def\editors{<TeXML escape="1"><xsl:call-template name="editors" /></TeXML>}
+                <xsl:if test="@funders">
+                    \def\funders{Publikację wsparli i wsparły:
+                        <TeXML escape="1"><xsl:value-of select="@funders" /></TeXML>.}
+                </xsl:if>
+
+                <xsl:if test="@sponsor-note|data-sponsor">
+                    \def\sponsors{
+                        \scriptsize
+                        <xsl:choose>
+                            <xsl:when test="@sponsor-note">
+                                <TeXML escape="1"><xsl:value-of select="@sponsor-note" /></TeXML>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                Sfinansowano ze~środków:
+                            </xsl:otherwise>
+                        </xsl:choose>
+
+                        \vspace{1em}
+
+                        <xsl:apply-templates select="data-sponsor" mode="sponsor" />
+                    }
+                </xsl:if>
+            </TeXML>
+
             <cmd name="editorialsection" />
             <cmd name="editorialsection" />
+
         </env>
     </TeXML>
 </xsl:template>
         </env>
     </TeXML>
 </xsl:template>
 
 <xsl:template match="rdf:RDF" mode="titlepage">
     <TeXML escape="0">
 
 <xsl:template match="rdf:RDF" mode="titlepage">
     <TeXML escape="0">
-        \def\authors{<xsl:call-template name="authors" />}
+        \def\authors{<TeXML escape="1"><xsl:call-template name="authors" /></TeXML>}
         \author{\authors}
         \author{\authors}
-        \title{<xsl:apply-templates select=".//dc:title" />}
-        \def\translatorsline{<xsl:call-template name="translators" />}
+        \title{<TeXML escape="1"><xsl:apply-templates select=".//dc:title" mode="inline" /></TeXML>}
+        \def\translatorsline{<TeXML escape="1"><xsl:call-template name="translators" /></TeXML>}
 
 
-        \def\bookurl{<xsl:value-of select=".//dc:identifier.url" />}
+        \def\bookurl{<TeXML escape="1"><xsl:value-of select=".//dc:identifier.url" /></TeXML>}
 
 
-        \def\rightsinfo{Ten utwór nie jest chroniony prawem autorskim i~znajduje się w~domenie
+        \def\rightsinfo{Ten utwór nie jest objęty majątkowym prawem autorskim i~znajduje się w~domenie
             publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować
             i~rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami
             (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to
             publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować
             i~rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami
             (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to
             Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL}.}
         <xsl:if test=".//dc:rights.license">
             \def\rightsinfo{Ten utwór jest udostepniony na licencji
             Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL}.}
         <xsl:if test=".//dc:rights.license">
             \def\rightsinfo{Ten utwór jest udostepniony na licencji
-            \href{<xsl:value-of select=".//dc:rights.license" />}{<xsl:value-of select=".//dc:rights" />}.}
+            \href{<xsl:value-of select=".//dc:rights.license" />}{<TeXML escape="1"><xsl:apply-templates select=".//dc:rights" mode="inline" /></TeXML>}.}
         </xsl:if>
 
         \def\sourceinfo{
             <xsl:if test=".//dc:source">
         </xsl:if>
 
         \def\sourceinfo{
             <xsl:if test=".//dc:source">
-                Tekst opracowany na podstawie: <xsl:apply-templates select=".//dc:source" mode="inline" />
+                Tekst opracowany na podstawie: <TeXML escape="1"><xsl:apply-templates select=".//dc:source" mode="inline" /></TeXML>
                 \vspace{.6em}
             </xsl:if>}
                 \vspace{.6em}
             </xsl:if>}
-        \def\description{<xsl:apply-templates select=".//dc:description" mode="inline" />}
-        \def\editors{<xsl:call-template name="editors" />}
+        \def\publisherinfo{
+            <xsl:if test=".//dc:publisher">
+                Wydawca:
+                <TeXML escape="1">
+                    <xsl:for-each select=".//dc:publisher/text()">
+                        <xsl:value-of select="."/>
+                        <xsl:if test="not(position() = last())">, </xsl:if>
+                    </xsl:for-each>
+                </TeXML>
+                \vspace{.6em}
+            </xsl:if>}
+        \def\description{<TeXML escape="1"><xsl:apply-templates select=".//dc:description" mode="inline" /></TeXML>}
+        <xsl:if test=".//meta[@id='pdf-id']">
+            <xsl:variable name="isbn" select=".//meta[@id='pdf-id']"/>
+            \def\isbn{ISBN <xsl:value-of select="substring-after($isbn, 'ISBN-')"/>}
+        </xsl:if>
     </TeXML>
 </xsl:template>
 
     </TeXML>
 </xsl:template>
 
     </cmd>
 </xsl:template>
 
     </cmd>
 </xsl:template>
 
+<xsl:template match="ilustr">
+    <cmd name="ilustr">
+        <parm><xsl:value-of select="@src" /></parm>
+        <parm><xsl:value-of select="@alt" /></parm>
+    </cmd>
+</xsl:template>
 
 <!-- ========================================== -->
 <!-- = PARAGRAPH TAGS                         = -->
 
 <!-- ========================================== -->
 <!-- = PARAGRAPH TAGS                         = -->
 <!-- ================================================ -->
 
 <xsl:template mode="inline"
 <!-- ================================================ -->
 
 <xsl:template mode="inline"
-    match="pa|pe|pr|pt|mat|didask_tekst|slowo_obce|wyroznienie|osoba">
+    match="pa|pe|pr|pt|mat|didask_tekst|slowo_obce|wyroznienie|osoba|indeks_dolny">
     <cmd>
         <xsl:attribute name="name">
             <xsl:value-of select="wl:texcommand(name())" />
     <cmd>
         <xsl:attribute name="name">
             <xsl:value-of select="wl:texcommand(name())" />
 </xsl:template>
 
 <xsl:template name="editors">
 </xsl:template>
 
 <xsl:template name="editors">
-    <xsl:if test="//dc:contributor.editor_parsed|//dc:contributor.technical_editor_parsed">
+    <xsl:if test="@editors">
         <xsl:text>Opracowanie redakcyjne i przypisy: </xsl:text>
         <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="position() != 1">, </xsl:if>
-            <xsl:apply-templates mode="inline" />
-        </xsl:for-each>.
+        <xsl:value-of select="@editors" />
+        <xsl:text>.</xsl:text>
     </xsl:if>
 </xsl:template>
 
     </xsl:if>
 </xsl:template>
 
     </xsl:if>
 </xsl:template>
 
     </xsl:if>
 </xsl:template>
 
+<xsl:template match="data-sponsor" mode="sponsor">
+    <cmd name="par"><parm>
+    <xsl:choose>
+        <xsl:when test="@src">
+            \includegraphics[height=0.25\textwidth,width=0.25\textwidth,keepaspectratio]{<xsl:value-of select="@src" />}
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="@name" />
+        </xsl:otherwise>
+    </xsl:choose>
+    </parm></cmd>
+</xsl:template>
+
+<xsl:template match="mat" mode="inline">
+    <TeXML escape="0">
+        <xsl:text>$</xsl:text>
+        <xsl:value-of select="wl:mathml_latex(.)" />
+        <xsl:text>$</xsl:text>
+    </TeXML>
+</xsl:template>
+
+<xsl:template match="mat">
+    <TeXML escape="0">
+        <xsl:text>$$</xsl:text>
+        <xsl:value-of select="wl:mathml_latex(.)" />
+        <xsl:text>$$</xsl:text>
+    </TeXML>
+</xsl:template>
+
+<xsl:template match="tabela|tabelka">
+    <cmd name="par" />
+    <cmd name="vspace"><parm>1em</parm></cmd>
+    <group><cmd name="raggedright" />
+    <xsl:element name="env">
+        <xsl:attribute name="name">
+            <xsl:choose>
+                <xsl:when test="name(.)='tabela'">longtabu</xsl:when>
+                <xsl:otherwise>tabu</xsl:otherwise>
+            </xsl:choose>
+        </xsl:attribute> to <TeXML escape="0">\textwidth </TeXML>
+      <!--parm><cmd name="textwidth"/></parm-->
+      <parm><TeXML escape="0"><xsl:value-of select="@_format" /></TeXML></parm>
+        <xsl:choose>
+        <xsl:when test="@ramka='1' or @ramki='1'">
+          <cmd name="hline" />
+          <xsl:apply-templates mode="wiersze-ramki"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates/>
+        </xsl:otherwise>
+        </xsl:choose>
+    </xsl:element>
+    </group>
+    <cmd name="vspace"><parm>1em</parm></cmd>
+</xsl:template>
+<xsl:template match="wiersz" mode="wiersze-ramki">
+    <xsl:apply-templates />
+    <spec cat="esc"/><spec cat="esc"/>
+    <cmd name="hline" gr="0" />
+</xsl:template>
+<xsl:template match="wiersz">
+    <xsl:apply-templates />
+    <spec cat="esc"/><spec cat="esc"/>
+</xsl:template>
+<xsl:template match="kol">
+    <xsl:apply-templates mode="inline"/>
+    <xsl:if test="position() &lt; last()">
+    <spec cat="align"/>
+    </xsl:if>
+</xsl:template>
+
 
 <!-- ============== -->
 <!-- = ADDED TAGS = -->
 
 <!-- ============== -->
 <!-- = ADDED TAGS = -->
 <xsl:template match="extra|uwaga" mode="inline" />
 
 <xsl:template match="nota_red" />
 <xsl:template match="extra|uwaga" mode="inline" />
 
 <xsl:template match="nota_red" />
+<xsl:template match="abstrakt" />
 
 <!-- ======== -->
 <!-- = TEXT = -->
 
 <!-- ======== -->
 <!-- = TEXT = -->
 </xsl:template>
 
 
 </xsl:template>
 
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>