diff options
author | Frederick Yin <fkfd@fkfd.me> | 2023-11-29 11:20:05 -0500 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2023-11-29 11:20:05 -0500 |
commit | 9b5e301bf754fe0ac551a847a397fb1b9c2b0a36 (patch) | |
tree | dc708b404b69dbea5083064d6e65a67019cdee61 | |
parent | ede956e8aee55be7d1fadb32ad32cfc62ac5d513 (diff) |
atom: do not include headerlink
-rwxr-xr-x | atom/atom.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/atom/atom.py b/atom/atom.py index 3a77d5f..c6e38d2 100755 --- a/atom/atom.py +++ b/atom/atom.py @@ -74,7 +74,9 @@ def add_comic(num, dryrun=False): "url": f"https://fkfd.me/comics/{info['num']}", "title": "Comic: " + info["title"], "date": utc_date(), - "html": '<p><img src="{0}"/></p><p>{1}</p>'.format(info["img"], info["alt"]), + "html": '<p><img src="{0}" alt="{1}"></p><p>{2}</p>'.format( + info["img"], info["transcript"], info["alt"] + ), }, dryrun=dryrun, ) @@ -82,6 +84,7 @@ def add_comic(num, dryrun=False): def add_blogpost(path, dryrun=False): # example path: "shitpost/flat_egg", "projects/byseekel" + path = path.strip("/") try: f = open(BLOG_DIR + f"/site/{path}/index.html") except FileNotFoundError: @@ -92,13 +95,16 @@ def add_blogpost(path, dryrun=False): f.close() soup = BeautifulSoup(html, "html.parser") main = soup.find(role="main") - url = f"https://fkfd.me/{path.strip('/')}/" # trailing slash necessary + url = f"https://fkfd.me/{path}/" # trailing slash necessary # convert all relative paths to absolute URLs for img in main.find_all("img"): img["src"] = urlparse.urljoin(url, img["src"]) for a in main.find_all("a"): + if "headerlink" in a["class"]: # remove "ΒΆ" + a.decompose() + continue a["href"] = urlparse.urljoin(url, a["href"]) add_entry( |