mirror of https://github.com/caronc/apprise
Escape new lines for TEXT->HTML conversions (#617)
parent
1519e98cda
commit
e95484349e
|
@ -359,7 +359,7 @@ class URLBase(object):
|
||||||
.replace(u' ', u' ')
|
.replace(u' ', u' ')
|
||||||
|
|
||||||
if convert_new_lines:
|
if convert_new_lines:
|
||||||
return escaped.replace(u'\n', u'<br/>')
|
return escaped.replace(u'\n', u'<br/>')
|
||||||
|
|
||||||
return escaped
|
return escaped
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,8 @@ def text_to_html(content):
|
||||||
Converts specified content from plain text to HTML.
|
Converts specified content from plain text to HTML.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return URLBase.escape_html(content)
|
# First eliminate any carriage returns
|
||||||
|
return URLBase.escape_html(content, convert_new_lines=True)
|
||||||
|
|
||||||
|
|
||||||
def html_to_text(content):
|
def html_to_text(content):
|
||||||
|
|
|
@ -183,7 +183,7 @@ def test_notify_base():
|
||||||
|
|
||||||
assert NotifyBase.escape_html(
|
assert NotifyBase.escape_html(
|
||||||
"<content>'\t \n</content>", convert_new_lines=True) == \
|
"<content>'\t \n</content>", convert_new_lines=True) == \
|
||||||
'<content>'  <br/></content>'
|
'<content>'  <br/></content>'
|
||||||
|
|
||||||
# Test invalid data
|
# Test invalid data
|
||||||
assert NotifyBase.split_path(None) == []
|
assert NotifyBase.split_path(None) == []
|
||||||
|
|
Loading…
Reference in New Issue