tools: expandNewLinesToXHTML replaces two or more \n instead of each ones

This commit is contained in:
souliane 2015-12-11 07:54:14 +01:00
commit d38543029f

View file

@ -1354,13 +1354,12 @@ class ElementParser(object):
def expandNewLinesToXHTML(text):
"""If not present yet, add a <br /> before all \n occurences.
"""Replace two or more "\n" with "\n<br />\n".
@param text(unicode)
@return unicode
"""
# if present, replace <br> (HTML), <br > and <br/> at end of line with <br /> (XHTML)
return re.sub(r"<br[ ]?/?>\n", "\n", text).replace("\n", "<br />\n")
return re.sub(r"\n{2,}", "\n<br />\n", text)
def decapsulateDomishContent(elt):