diff --git a/legi2pdf/lib/legi2pdf/pdfGenerator.py b/legi2pdf/lib/legi2pdf/pdfGenerator.py index b5d3721..7f53428 100755 --- a/legi2pdf/lib/legi2pdf/pdfGenerator.py +++ b/legi2pdf/lib/legi2pdf/pdfGenerator.py @@ -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 diff --git a/legi2pdf/xsl/db2latex_custom.xsl b/legi2pdf/xsl/db2latex_custom.xsl index c266285..798eb65 100644 --- a/legi2pdf/xsl/db2latex_custom.xsl +++ b/legi2pdf/xsl/db2latex_custom.xsl @@ -107,6 +107,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. \usepackage[T1]{fontenc} \usepackage{ucs} \usepackage{relsize} + \usepackage{hyphenat} % -------------------------------------------- % Check for PDFLaTeX/LaTeX % --------------------------------------------