allow strofa inside table + fix table border in html/epub + fix empty verses in epub
authorJan Szejko <janek37@gmail.com>
Fri, 4 Aug 2017 15:16:31 +0000 (17:16 +0200)
committerJan Szejko <janek37@gmail.com>
Fri, 4 Aug 2017 15:16:31 +0000 (17:16 +0200)
librarian/epub.py
librarian/epub/style.css
librarian/epub/xsltScheme.xsl
librarian/fb2/poems.xslt
librarian/pdf/wl2tex.xslt
librarian/xslt/book2html.xslt

index 3e9056c..95e65f1 100644 (file)
@@ -201,6 +201,8 @@ class Stanza(object):
         if not text:
             return
         for i, verse_text in enumerate(re.split(r"/\s*\n", text)):
+            if not verse_text.strip():
+                continue
             if i:
                 self.open_normal_verse()
             verse = self.get_open_verse()
index 78ed5bc..e40c754 100644 (file)
@@ -371,7 +371,8 @@ p.footer {
 
 table {
     border-collapse: collapse;
+    width: 100%;
 }
-td {
+table.border th, table.border td {
     border: 1px solid black;
 }
index 3b7036c..e04cb9d 100644 (file)
     </div>
   </xsl:template>
 
-  <xsl:template match="ilustr" mode="inline">
-    <xsl:apply-templates select="." />
-  </xsl:template>
-
   <xsl:template match="ilustr">
     <img>
       <xsl:attribute name="src">
 </xsl:template>
 
 <xsl:template match="tabela|tabelka">
-  <table xmlns="http://www.w3.org/1999/xhtml">
-    <xsl:apply-templates />
-  </table>
+    <xsl:choose>
+        <xsl:when test="@ramka = '1'">
+            <table class="border" xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates /></table>
+        </xsl:when>
+        <xsl:otherwise>
+            <table xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates /></table>
+        </xsl:otherwise>
+    </xsl:choose>
 </xsl:template>
 <xsl:template match="wiersz">
   <tr xmlns="http://www.w3.org/1999/xhtml">
index 82e164f..257795b 100644 (file)
                </stanza>
        </xsl:template>
 
+       <xsl:template mode="inline" match="strofa">
+               <xsl:apply-templates select="." mode="para"/>
+       </xsl:template>
+
        <!-- XXX: it should be done elsewhere but our cheap verse splitting
                puts it here -->
        <xsl:template match="motyw" mode="poem"/>
index 4c8be32..85375a2 100644 (file)
     </cmd>
 </xsl:template>
 
+<xsl:template match="strofa" mode="inline">
+    <env name="minipage">
+        <parm><cmd name="linewidth" /></parm>
+        <parm><xsl:apply-templates select="." /></parm>
+    </env>
+</xsl:template>
+
 <xsl:template match="strofa">
   <cmd name="strofa"><parm>
     <xsl:choose>
index c4757e1..4b6c72a 100644 (file)
     </p>
 </xsl:template>
 
+<xsl:template match="strofa" mode="inline">
+    <xsl:apply-templates select="." />
+</xsl:template>
+
 <xsl:template match="strofa">
     <div class="stanza">
       <xsl:call-template name="section-anchor"/>
 </xsl:template>
 
 <xsl:template match="tabela|tabelka">
-    <table><xsl:apply-templates /></table>
+    <xsl:choose>
+        <xsl:when test="@ramka = '1'">
+            <table class="border"><xsl:apply-templates /></table>
+        </xsl:when>
+        <xsl:otherwise>
+            <table><xsl:apply-templates /></table>
+        </xsl:otherwise>
+    </xsl:choose>
 </xsl:template>
 <xsl:template match="wiersz">
     <tr><xsl:apply-templates /></tr>