# HG changeset patch # User souliane # Date 1449816854 -3600 # Node ID b2d6f3c9284217ffe991cca02d3cbdd1ee96328e # Parent 56fa4e7e158c5a51d2c1d87f6b30119f3fd21b79 tools: expandNewLinesToXHTML replaces two or more \n instead of each ones diff -r 56fa4e7e158c -r b2d6f3c92842 src/tools/xml_tools.py --- a/src/tools/xml_tools.py Thu Dec 10 15:14:23 2015 +0100 +++ b/src/tools/xml_tools.py Fri Dec 11 07:54:14 2015 +0100 @@ -1354,13 +1354,12 @@ def expandNewLinesToXHTML(text): - """If not present yet, add a
before all \n occurences. + """Replace two or more "\n" with "\n
\n". @param text(unicode) @return unicode """ - # if present, replace
(HTML),
and
at end of line with
(XHTML) - return re.sub(r"\n", "\n", text).replace("\n", "
\n") + return re.sub(r"\n{2,}", "\n
\n", text) def decapsulateDomishContent(elt):