class ParseError(Exception):
def __str__(self):
""" Dirty workaround for Python Unicode handling problems. """
- return self.message.message
+ return self.message
def __unicode__(self):
""" Dirty workaround for Python Unicode handling problems. """
- return self.message.message
+ return self.message
class ValidationError(Exception):
pass
'wl2tex': 'pdf/wl2tex.xslt',
}
+CUSTOMIZATIONS = [
+ 'nofootnotes',
+ 'nothemes',
+ 'onehalfleading',
+ 'doubleleading',
+ 'nowlfont',
+ ]
def insert_tags(doc, split_re, tagname, exclude=None):
""" inserts <tagname> for every occurence of `split_re' in text nodes in the `doc' tree
def transform(provider, slug=None, file_path=None,
output_file=None, output_dir=None, make_dir=False, verbose=False, save_tex=None, morefloats=None,
- cover=None, flags=None):
+ cover=None, flags=None, customizations=None):
""" produces a PDF file with XeLaTeX
provider: a DocProvider
morefloats (old/new/none): force specific morefloats
cover: a cover.Cover object
flags: less-advertising,
+ customizations: user requested customizations regarding various formatting parameters (passed to wl LaTeX class)
"""
# Parse XSLT
elif package_available('morefloats', 'maxfloats=19'):
document.edoc.getroot().set('morefloats', 'new')
+ # add customizations
+ if customizations is not None:
+ document.edoc.getroot().set('customizations', u','.join(customizations))
+
# hack the tree
move_motifs_inside(document.edoc)
hack_motifs(document.edoc)
# wl -> TeXML
style_filename = get_stylesheet("wl2tex")
style = etree.parse(style_filename)
+
texml = document.transform(style)
# TeXML -> LaTeX
% a4paper,... - paper size as required by LaTeX
% nowlfont - don't use customized WL font
-%\usepackage{setspace}
-
+\RequirePackage{setspace}
\RequirePackage{type1cm}
\DeclareOption{13pt}{%
\AtEndOfClass{%
\DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
\DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
+%% This does not really work, since dvipdfm(x) will use it's configuration in /etc/texmf/dvipdfm(x) and force a global paper size setting.
+\DeclareOption{a5paper}{%
+ \setlength{\paperheight}{210mm}%
+ \setlength{\paperwidth}{148mm}}
+
+
\newif\ifshowfootnotes \showfootnotestrue
\DeclareOption{nofootnotes}{\showfootnotesfalse}
<xsl:template match="utwor">
<TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
<TeXML escape="0">
- \documentclass[a4paper, oneside, 11pt]{book}
+ \documentclass[<xsl:value-of select="@customizations"/>]{wl}
<!-- flags and values set on root -->
\def\<xsl:value-of select="wl:texcommand(name())" />{<TeXML escape="1"><xsl:value-of select="."/></TeXML>}
</TeXML>
</xsl:for-each>
-
- \usepackage{wl}
</TeXML>
<xsl:choose>