add custom processing of text nodes, for -- subsitution (#5854)
This commit is contained in:
parent
996b4a112f
commit
4d812d6990
|
@ -265,6 +265,15 @@ def convertLegi2Tex(input, outputFileName, annexes, d, draft=0, toc=True,
|
|||
xsl_style.freeStylesheet()
|
||||
insertAnnex(preprocessed_xml_doc, annexes, d)
|
||||
|
||||
ctxt = preprocessed_xml_doc.xpathNewContext()
|
||||
# some custom preprocessing of text content:
|
||||
# marks -- as TABELLIO-- so substitution with the proper command
|
||||
# (\hyp{}) can happen in the postprocessing phase.
|
||||
for node in ctxt.xpathEval('//text()'):
|
||||
if '--' in node.content:
|
||||
node.setContent(node.content.replace('--', 'TABELLIO--'))
|
||||
ctxt.xpathFreeContext()
|
||||
|
||||
# processing
|
||||
if draft:
|
||||
xslParam['with-draft-tag'] = '1'
|
||||
|
@ -291,7 +300,8 @@ def convertLegi2Tex(input, outputFileName, annexes, d, draft=0, toc=True,
|
|||
for before, after in [(u'’', u"'"), (u'\u2019', u"'"),
|
||||
(u'“', u'\guillemotleft'), (u'\u201C', u'«'),
|
||||
(u'”', u'\guillemotright'), (u'\u201D', u'»'),
|
||||
(u'‑', u'-'), (u'\u2011', u'-')]:
|
||||
(u'‑', u'-'), (u'\u2011', u'-'),
|
||||
(u'TABELLIO--', u'\hyp{}'),]:
|
||||
doc = doc.replace(before, after)
|
||||
|
||||
# look for end of parts and change the multicol environment not to have
|
||||
|
|
|
@ -107,6 +107,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
<xsl:text>\usepackage[T1]{fontenc} </xsl:text>
|
||||
<xsl:text>\usepackage{ucs} </xsl:text>
|
||||
<xsl:text>\usepackage{relsize} </xsl:text>
|
||||
<xsl:text>\usepackage{hyphenat} </xsl:text>
|
||||
<xsl:text>% -------------------------------------------- </xsl:text>
|
||||
<xsl:text>% Check for PDFLaTeX/LaTeX </xsl:text>
|
||||
<xsl:text>% -------------------------------------------- </xsl:text>
|
||||
|
|
Reference in New Issue