def transform(wldoc, verbose=False, save_tex=None, morefloats=None,
- cover=None, flags=None, customizations=None):
+ cover=None, flags=None, customizations=None,
+ imgdir=""):
""" produces a PDF file with XeLaTeX
wldoc: a WLDocument
style = etree.parse(style_filename)
texml = document.transform(style)
-
+ etree.dump(texml.getroot())
# TeXML -> LaTeX
temp = mkdtemp('-wl2pdf')
with open(os.path.join(temp, 'cover.jpg'), 'w') as f:
the_cover.save(f)
+ for img in document.edoc.findall('//ilustr'):
+ shutil.copy(os.path.join(imgdir, img.get('src')), temp)
+
+
del document # no longer needed large object :)
tex_path = os.path.join(temp, 'doc.tex')
return OutputFile.from_filename(output_file.name)
except (XMLSyntaxError, XSLTApplyError), e:
+ print e
raise ParseError(e)
</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>
+
+<xsl:template match="@*|node()" mode="identity">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="identity"/>
+ </xsl:copy>
+</xsl:template>
+
+
+
+<xsl:template match="dmath">
+ <dmath>
+ <xsl:apply-templates mode="identity"/>
+ </dmath>
+</xsl:template>
+
+<xsl:template match="math" mode="inline">
+ <math>
+ <xsl:apply-templates mode="identity"/>
+ </math>
+</xsl:template>
+
+
<!-- ================ -->
<!-- = SPECIAL TAGS = -->