tools: expandNewLinesToXHTML replaces two or more \n instead of each ones
This commit is contained in:
parent
7e9833b921
commit
d38543029f
1 changed files with 2 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue