python 2.5 does not support tuple.index()
[librarian.git] / librarian / pdf / wl2tex.xslt
index 5a49a01..1a675ba 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">
+            <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>
+                </cmd>
+            </xsl:if>
             <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" />
+
+            <TeXML escape="0">
+                \def\coverby{
+                <xsl:if test="@data-cover-by">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>
+                }
+            </TeXML>
+
             <cmd name="editorialsection" />
         </env>
     </TeXML>
     <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" />}
 </xsl:template>
 
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>