merge conflicting on stripping spaces publication
authorMarcin Koziej <marcinkoziej@nowoczesnapolska.org.pl>
Mon, 3 Feb 2014 14:06:46 +0000 (15:06 +0100)
committerMarcin Koziej <marcinkoziej@nowoczesnapolska.org.pl>
Mon, 3 Feb 2014 14:06:46 +0000 (15:06 +0100)
librarian/epub.py
librarian/epub/style.css
librarian/epub/xsltScheme.xsl
librarian/pdf.py
librarian/pdf/wl2tex.xslt

index 8dc11c7..de136ea 100644 (file)
@@ -330,6 +330,12 @@ def transform_chunk(chunk_xml, chunk_no, annotations, empty=False, _empty_html_s
     return output_html, toc, chars
 
 
+def flatten_image_paths(wldoc):
+    root = wldoc.edoc.getroot()
+    for node in root.findall(".//ilustr"):
+        node.attrib['src'] = os.path.basename(node.attrib['src'])
+    return wldoc
+
 def render_latex(wldoc, prefix="latex"):
     """
     Renders <latex>CODE</latex> as images and returns
@@ -398,6 +404,8 @@ def transform(wldoc, verbose=False,
             if main_text.tag == RDFNS('RDF'):
                 main_text = None
 
+        flatten_image_paths(wldoc)
+
         if main_text is not None:
             for chunk_xml in chop(main_text):
                 empty = False
index d3ca5b6..f279ca8 100644 (file)
@@ -379,5 +379,10 @@ img.latex {
     display: block;
     width: 50%;
     float: right;
+    clear: both;
+    margin: 10pt;
+    padding: 0pt 5pt;
     background-color: #d0d0d0;
+    font-style: italic;
+    font-size: 0.8em;
 }
\ No newline at end of file
index f273c4b..7ec1f8b 100644 (file)
 
   <xsl:template match="podtytul" />
 
-  <xsl:template match="naglowek_czesc|srodtytul">
+  <xsl:template match="naglowek_czesc">
     <h2 class="h2" xmlns="http://www.w3.org/1999/xhtml">
       <xsl:apply-templates />
     </h2>
     </h2>
   </xsl:template>
 
-  <xsl:template match="naglowek_podpodrozdzial">
+  <xsl:template match="naglowek_podpodrozdzial|srodtytul">
     <a xmlns="http://www.w3.org/1999/xhtml"></a>
     <div class="p" xmlns="http://www.w3.org/1999/xhtml">
       <xsl:apply-templates />
     <img>
       <xsl:attribute name="src"><xsl:value-of select="@src"/>.<xsl:choose><xsl:when test="@extbitmap"><xsl:value-of select="@extbitmap"/></xsl:when><xsl:otherwise><xsl:value-of select="@ext"/></xsl:otherwise></xsl:choose></xsl:attribute>
     </img>
+    <xsl:apply-templates />
   </xsl:template>
 
   <xsl:template match="img">
index ead91be..a5c4253 100644 (file)
@@ -286,6 +286,9 @@ def transform(wldoc, verbose=False, save_tex=None, save_texml=None, morefloats=N
             cwd = None
         os.chdir(temp)
 
+        if resources:
+            os.putenv("TEXINPUTS", "::.:%s" % resources)
+
         if verbose:
             p = call(['xelatex', tex_path])
         else:
index 635029b..fd14d5c 100644 (file)
 <!-- = INLINE TAGS                                  = -->
 <!-- = (contain other inline tags and special tags) = -->
 <!-- ================================================ -->
-<xsl:strip-space elements="wyroznienie|akap|nota"/>
+
+<xsl:strip-space elements="nota|akap|wyroznienie"/>
 
 <xsl:template mode="inline"
     match="pa|pe|pr|pt|mat|didask_tekst|slowo_obce|wyroznienie|osoba|punkt|www|nota_red">