Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
logilab-mtconverter
Commits
138906d00726
Commit
e0be5c21
authored
Jan 30, 2009
by
sylvain.thenault@logilab.fr
Browse files
new xml_escape function, doing html_escape + control characters escaping
parent
4897d2f956ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
__init__.py
View file @
138906d0
...
...
@@ -86,6 +86,10 @@ def html_escape(data):
return
(
data
.
replace
(
'&'
,
'&'
).
replace
(
'<'
,
'<'
).
replace
(
'>'
,
'>'
)
.
replace
(
'"'
,
'"'
).
replace
(
"'"
,
'''
))
def
xml_escape
(
data
):
# XXX remove more control characters
return
html_escape
(
data
).
replace
(
'
\f
'
,
'
\n
'
).
replace
(
'
\b
'
,
''
)
def
html_unescape
(
data
):
"""unescapes XML/HTML entities"""
for
entityname
,
codepoint
in
htmlentitydefs
.
name2codepoint
.
iteritems
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment