Skip to content

Commit

Permalink
Moved function to library
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Dec 17, 2019
1 parent cb9f666 commit ee954e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/fix_tei.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,6 @@ def parse_bibtex(bibfile):
return tmp_dict
# def parse_bibtex ends here

def restore_xml_tags(text):
"""Convert XML entities back to code
&lt; => <
"""

replacements = {
"&lt;" : "<",
"&gt;" : ">",
"&apos;" : "'",
"&amp;" : "&"
}

for item in replacements:
text = text.replace(item, replacements[item])

return text
# def restore_xml_tags ends here

def unescape(text):
"""Remove HTML or XML character references and entities from a text
Expand Down
19 changes: 19 additions & 0 deletions src/utils/libeoaconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,22 @@ def translate(term, publang, translation_file):
else:
return translated_term
# def translate ends here
def restore_xml_tags(text):
"""Convert XML entities back to code
&lt; => <
"""

replacements = {
"&lt;" : "<",
"&gt;" : ">",
"&apos;" : "'",
"&amp;" : "&"
}

for item in replacements:
text = text.replace(item, replacements[item])

return text
# def restore_xml_tags ends here

0 comments on commit ee954e8

Please sign in to comment.