diff --git a/src/rss.py b/src/rss.py index 1a8cfbf..f5dd3e3 100644 --- a/src/rss.py +++ b/src/rss.py @@ -42,7 +42,6 @@ def _is_image_token(token: str, extensions): # this is similar to the markup function in microblog def enrich_msg( lines, - is_atom=True, accepted_images=[], base_url="", trailing_punctuation="", @@ -57,6 +56,7 @@ def enrich_msg( words = line.split() for i in range(len(words)): word = words[i] + core = word.rstrip(trailing_punctuation) if word.find("src=") == 0 \ or word.find("href=") == 0: continue @@ -64,14 +64,12 @@ def enrich_msg( w = escape(word) new_word = ("%s") % (w, w) words[i] = new_word - elif not is_atom: - core = word.rstrip(trailing_punctuation) - if _is_image_token(core, accepted_images): - suffix = word[len(core):] - abs_url = urljoin(base_url, core) - anchor = f"{escape(abs_url)}" - new_word = anchor + suffix - words[i] = new_word + elif _is_image_token(core, accepted_images): + suffix = word[len(core):] + abs_url = urljoin(base_url, core) + anchor = f"{escape(abs_url)}" + new_word = anchor + suffix + words[i] = new_word words.insert(0,"
") words.append("
") content.append(" ".join(words)) @@ -117,7 +115,6 @@ def write_feed(posts, filename, params, tagname=None): de = " ".join( enrich_msg( msg, - is_atom=params["use_atom"], base_url=params["url"], accepted_images=params["accepted_images"], trailing_punctuation=params["trailing_punctuation"],