From d38543029f7a1904df3a6eb370b646ed9bad61f1 Mon Sep 17 00:00:00 2001 From: souliane Date: Fri, 11 Dec 2015 07:54:14 +0100 Subject: [PATCH] tools: expandNewLinesToXHTML replaces two or more \n instead of each ones --- src/tools/xml_tools.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py index ac2bf35c..dafc2507 100644 --- a/src/tools/xml_tools.py +++ b/src/tools/xml_tools.py @@ -1354,13 +1354,12 @@ class ElementParser(object): 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):