]> git.scottworley.com Git - paperdoorknob/blobdiff - domfilter.py
Apply bare-\emph fix to \st too
[paperdoorknob] / domfilter.py
index 22f96a13b23c51c02229b5a3eaf5740d37bf8303..e1095f0f856842d3d8fa9819dd36d57c4d1fda92 100644 (file)
@@ -10,9 +10,16 @@ from typing import Any, Callable, List, Tuple
 from bs4.element import Tag
 
 
+def _changeTag(tag: Tag, new_name: str) -> Tag:
+    tag.name = new_name
+    return tag
+
+
 DOMFilters: List[Tuple[str, Callable[[Tag], Any]]] = [
     ("NoEdit", lambda x: [eb.decompose() for eb in x.find_all("div", class_="post-edit-box")]),
     ("NoFooter", lambda x: [foot.decompose() for foot in x.find_all("div", class_="post-footer")]),
+    ("Strike", lambda x: [_changeTag(span, 's')
+                          for span in x.find_all("span", style="text-decoration: line-through;")]),
 ]