diff options
author | neodarz <neodarz@neodarz.net> | 2019-05-26 12:34:24 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-05-26 12:34:24 +0200 |
commit | c29e1ab61ab659eb9ba1f440a3d52aa4294d70c3 (patch) | |
tree | 5e4ee006565b65f11194a4b0715fb231bf8e6b0e /pyblog | |
parent | 28289ae4f3ac197489feda201843407e1f7f2537 (diff) | |
download | my_new_personal_website-c29e1ab61ab659eb9ba1f440a3d52aa4294d70c3.tar.xz my_new_personal_website-c29e1ab61ab659eb9ba1f440a3d52aa4294d70c3.zip |
Move process_footnote_backlinks function to external file
Diffstat (limited to '')
-rwxr-xr-x | pyblog | 14 |
1 files changed, 1 insertions, 13 deletions
@@ -766,18 +766,6 @@ def generate_index_and_feed(): generate_sitemap(feed) -def process_footnote_backlinks(soup): - """Add class attribute "footnotes-backlink" to each footnote backlink.""" - for footnotes in soup.find_all("div", attrs={"class": "footnotes"}): - for fn_a_tag in footnotes.find_all(lambda tag: - tag.name == "a" and - tag.has_attr("href") and - tag["href"].startswith("#fnref") and - tag.string == "\u21A9"): # U+21A9: LEFTWARDS ARROW WITH HOOK - fn_a_tag["class"] = "footnotes-backlink" - fn_a_tag.string = "\u21A9\uFE0E" # U+FE0E: VARIATION SELECTOR-15 - - def postprocess_html_file(htmlfilepath): """Perform a series of postprocessing to an HTML file.""" with open(htmlfilepath, "r+", encoding="utf-8") as htmlfileobj: @@ -786,7 +774,7 @@ def postprocess_html_file(htmlfilepath): # a series of postprocessing (extensible) utils.process_image_sizes(soup) utils.link_img_tags(soup) - process_footnote_backlinks(soup) + utils.process_footnote_backlinks(soup) # write back htmlfileobj.seek(0) |