summaryrefslogtreecommitdiffstats
path: root/gallery_dl/text.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2019-07-20 05:51:44 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2019-07-20 05:51:44 -0400
commit2a63a9c9b7032a76894c48ac4d9cea732fcaee49 (patch)
tree3d5f633ff69cd393036a3dabc4d4533c8484f9ad /gallery_dl/text.py
parent195c45911e79c33cf0bb986721365fb06df5a153 (diff)
New upstream version 1.9.0upstream/1.9.0
Diffstat (limited to 'gallery_dl/text.py')
-rw-r--r--gallery_dl/text.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/gallery_dl/text.py b/gallery_dl/text.py
index 151fa30..81e87b5 100644
--- a/gallery_dl/text.py
+++ b/gallery_dl/text.py
@@ -36,12 +36,15 @@ def clean_xml(xmldata, repl=""):
return xmldata
-def remove_html(txt):
+def remove_html(txt, repl=" ", sep=" "):
"""Remove html-tags from a string"""
try:
- return " ".join(re.sub("<[^>]+>", " ", txt).split())
+ txt = re.sub("<[^>]+>", repl, txt)
except TypeError:
return ""
+ if sep:
+ return sep.join(txt.split())
+ return txt.strip()
def split_html(txt, sep=None):