images in html, pdf
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 31 Jan 2012 13:52:25 +0000 (14:52 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 31 Jan 2012 13:52:25 +0000 (14:52 +0100)
librarian/pdf.py
librarian/pdf/wl.cls
librarian/pdf/wl2tex.xslt
librarian/xslt/book2html.xslt

index 077a1e1..ace83af 100644 (file)
@@ -235,6 +235,9 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None,
             with open(os.path.join(temp, 'cover.png'), 'w') as f:
                 c.save(f)
 
+        for img in document.edoc.findall('//ilustr'):
+            shutil.copy(img.get('src'), temp)
+
         del document # no longer needed large object :)
 
         tex_path = os.path.join(temp, 'doc.tex')
index 08737f7..80a6bb5 100644 (file)
@@ -512,3 +512,11 @@ Letters={Uppercase}
 \fi
 }
 
+\newcommand{\ilustr}[2]{
+
+\vspace{1em}%
+\begin{center}%
+\par{\includegraphics{#1}\\#2}%
+\end{center}%
+\vspace{1em}%
+}
index a2c592e..c23a045 100644 (file)
     </cmd>
 </xsl:template>
 
+<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>
+        <parm><xsl:apply-templates mode="inline" /></parm>
+    </cmd>
+</xsl:template>
+
 
 <!-- ================ -->
 <!-- = SPECIAL TAGS = -->
index 10da3ec..b018405 100755 (executable)
     <hr class="spacer-line" />
 </xsl:template>
 
+<xsl:template match="ilustr">
+    <div xmlns="http://www.w3.org/1999/xhtml" class="ilustr">
+      <img xmlns="http://www.w3.org/1999/xhtml" alt="ilustracja">
+        <xsl:attribute name="src">
+          <xsl:value-of select="@src" />
+        </xsl:attribute>
+        <xsl:attribute name="alt">
+          <xsl:apply-templates mode="inline" />
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates mode="inline" />
+        </xsl:attribute>
+      </img>
+    </div>
+</xsl:template>
+
 
 <!-- ================ -->
 <!-- = SPECIAL TAGS = -->