tabelka for one-page tables
authorJan Szejko <janek37@gmail.com>
Tue, 21 Mar 2017 11:13:09 +0000 (12:13 +0100)
committerJan Szejko <janek37@gmail.com>
Tue, 21 Mar 2017 11:21:53 +0000 (12:21 +0100)
librarian/pdf.py
librarian/pdf/wl2tex.xslt

index c8af03b..927b50d 100644 (file)
@@ -18,6 +18,7 @@ from tempfile import mkdtemp, NamedTemporaryFile
 import re
 from copy import deepcopy
 from subprocess import call, PIPE
+from itertools import chain
 
 from Texml.processor import process
 from lxml import etree
@@ -102,7 +103,7 @@ def fix_tables(doc):
         if kol.tail is not None:
             if not kol.tail.strip():
                 kol.tail = None
-    for table in doc.iter(tag='tabela'):
+    for table in chain(doc.iter(tag='tabela'), doc.iter(tag='tabelka')):
         if table.get('ramka') == '1' or table.get('ramki') == '1':
             table.set('_format', '|' + 'X|' * len(table[0]))
         else:
index d39dea5..c3054d2 100644 (file)
     <cmd name="par" />
     <cmd name="vspace"><parm>1em</parm></cmd>
     <group><cmd name="raggedright" />
-    <env name="longtabu"> to <TeXML escape="0">\textwidth </TeXML>
+    <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:apply-templates/>
         </xsl:otherwise>
         </xsl:choose>
-    </env>
+    </xsl:element>
     </group>
     <cmd name="vspace"><parm>1em</parm></cmd>
 </xsl:template>