moglen cd
[librarian.git] / librarian / pdf / wl2tex.xslt
index 58bb68d..8fdeab4 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[<xsl:value-of select="@customizations"/>]{wl}
+        \documentclass[<xsl:value-of select="@customizations"/>]{<xsl:value-of select="@documentclass"/>}
 
         <!-- flags and values set on root -->
 
 
         <!-- flags and values set on root -->
 
@@ -33,7 +33,8 @@
         </xsl:for-each>
         </TeXML>
 
         </xsl:for-each>
         </TeXML>
 
-        <xsl:choose>
+<!-- WHAT. THE. FUCK. -->
+<!--        <xsl:choose>
             <xsl:when test="@morefloats = 'new'">
                 <TeXML escape="0">
                     \usepackage[maxfloats=64]{morefloats}
             <xsl:when test="@morefloats = 'new'">
                 <TeXML escape="0">
                     \usepackage[maxfloats=64]{morefloats}
@@ -52,7 +53,7 @@
                     }{}
                 </TeXML>
             </xsl:otherwise>
                     }{}
                 </TeXML>
             </xsl:otherwise>
-        </xsl:choose>
+        </xsl:choose>-->
 
         <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
         <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='titlepage' />
 
         <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
         <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='titlepage' />
                 </xsl:choose>
                 }
             </TeXML>
                 </xsl:choose>
                 }
             </TeXML>
-
-            <xsl:if test="@data-cover-width">
+           <!-- XXX fix this not to hardcode width -->
+            <!--<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>
                 <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 ->
-                    <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 ->
-                    <cmd name="translatorsline" />
-                </xsl:when>
-                <xsl:otherwise>
-                    <!- 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-->
+            </xsl:if>-->
+           <cmd name="makecover" />
+            <cmd name="maketitle" />
 
             <TeXML escape="0">
                 \def\coverby{
 
             <TeXML escape="0">
                 \def\coverby{
             </TeXML>
 
             <cmd name="editorialsection" />
             </TeXML>
 
             <cmd name="editorialsection" />
+           <cmd name="spistresci" />
 
             <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" />
 
             <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" />
         \def\authors{<xsl:call-template name="authors" />}
         \author{\authors}
         \title{<xsl:apply-templates select=".//dc:title" mode="inline" />}
         \def\authors{<xsl:call-template name="authors" />}
         \author{\authors}
         \title{<xsl:apply-templates select=".//dc:title" mode="inline" />}
+       \makeatletter
+       \let\theauthor\@author
+       \let\thetitle\@title
+       \makeatother
+
         \def\translatorsline{<xsl:call-template name="translators" />}
 
         \def\bookurl{<xsl:value-of select=".//dc:identifier.url" />}
         \def\translatorsline{<xsl:call-template name="translators" />}
 
         \def\bookurl{<xsl:value-of select=".//dc:identifier.url" />}
     </cmd>
 </xsl:template>
 
     </cmd>
 </xsl:template>
 
+<xsl:template match="autor_rozdzialu">
+</xsl:template>
 
 <xsl:template
 
 <xsl:template
-    match="naglowek_akt|naglowek_czesc|srodtytul|naglowek_osoba|naglowek_podrozdzial|naglowek_scena|naglowek_rozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_dialog|akap_cd|motto_podpis|naglowek_listy">
+    match="naglowek_akt|naglowek_czesc|srodtytul|naglowek_osoba|naglowek_podrozdzial|naglowek_scena|naglowek_rozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_dialog|akap_cd|motto_podpis|naglowek_listy|lista">
+  <xsl:if test="name(following-sibling::*[1])='autor_rozdzialu'">
+    <cmd name="autorrozdzialu"><parm><xsl:value-of select="following-sibling::*[1]/text()"/></parm></cmd>
+  </xsl:if>
     <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>
 
 
+<xsl:template match="link">
+  <cmd name="link">
+    <parm><xsl:value-of select="@url"/></parm>
+    <parm><xsl:apply-templates mode="inline"/></parm>
+  </cmd>
+</xsl:template>
+
+
 <xsl:template name="verse">
     <xsl:param name="verse-content" />
     <xsl:param name="verse-type" />
 <xsl:template name="verse">
     <xsl:param name="verse-content" />
     <xsl:param name="verse-type" />
 <!-- ================================================ -->
 
 <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|punkt|www">
     <cmd>
         <xsl:attribute name="name">
             <xsl:value-of select="wl:texcommand(name())" />
     <cmd>
         <xsl:attribute name="name">
             <xsl:value-of select="wl:texcommand(name())" />
     </cmd>
 </xsl:template>
 
     </cmd>
 </xsl:template>
 
+<xsl:template mode="inline"
+    match="wyimek">
+    <env>
+        <xsl:attribute name="name">
+            <xsl:value-of select="wl:texcommand(name())" />
+        </xsl:attribute>
+        <xsl:apply-templates mode="inline"/>
+    </env>
+</xsl:template>
+
+
 
 
 <xsl:template match="tytul_dziela" mode="inline">
 
 
 <xsl:template match="tytul_dziela" mode="inline">
     </cmd>
 </xsl:template>
 
     </cmd>
 </xsl:template>
 
+<xsl:strip-space elements="ilustr"/>
 <xsl:template match="ilustr">
     <cmd>
         <xsl:attribute name="name">
             <xsl:value-of select="wl:texcommand(name())" />
         </xsl:attribute>
 <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>
+       <xsl:if test="@opt">
+         <opt><TeXML ecape="0"><xsl:value-of select="normalize-space(@opt)" /></TeXML></opt>
+       </xsl:if>
+       <parm><TeXML escape="0"><xsl:value-of select="normalize-space(@src)" /></TeXML></parm>
         <parm><xsl:apply-templates mode="inline" /></parm>
     </cmd>
 </xsl:template>
         <parm><xsl:apply-templates mode="inline" /></parm>
     </cmd>
 </xsl:template>
   </math>
 </xsl:template>
 
   </math>
 </xsl:template>
 
+<xsl:template match="latex">
+  <TeXML escape="0">
+    <xsl:for-each select="text()">
+      <xsl:value-of select="normalize-space(.)"/>
+    </xsl:for-each>
+  </TeXML>
+</xsl:template>
+
+<xsl:template match="latex" mode="inline">
+  <TeXML escape="0">
+    <xsl:for-each select="text()">
+      <xsl:value-of select="normalize-space(.)"/>
+    </xsl:for-each>
+  </TeXML>
+</xsl:template>
+
+
 <xsl:template match="tablewrap">
   <cmd name="begin"><parm>table</parm><opt>h!</opt></cmd>
   <xsl:apply-templates select="table"/>
 <xsl:template match="tablewrap">
   <cmd name="begin"><parm>table</parm><opt>h!</opt></cmd>
   <xsl:apply-templates select="table"/>