Fix gallery_path

This commit is contained in:
Eloi Torrents 2025-09-06 09:58:40 +02:00
parent a372df0951
commit 68a5b2be65
2 changed files with 6 additions and 3 deletions

View File

@ -550,6 +550,7 @@ if __name__ == "__main__":
updated += writepage(tpl, tl, tc, cfg["page"],
paginate=True if new_posts is None else False)
cfg["rss"]["accepted_images"] = cfg["post"]["accepted_images"]
cfg["rss"]["gallery_path"] = cfg["post"]["gallery"]["path_to_fullsize"]
if cfg["rss"]["enabled"]:
# ensure output directory for feeds exists
if not os.path.exists("feeds"):

View File

@ -43,7 +43,7 @@ def _is_image_token(token: str, extensions):
def enrich_msg(
lines,
accepted_images=[],
base_url="",
gallery_path="",
trailing_punctuation="",
desc_len_limit=-1,
):
@ -66,7 +66,7 @@ def enrich_msg(
words[i] = new_word
elif _is_image_token(core, accepted_images):
suffix = word[len(core):]
abs_url = urljoin(base_url, core)
abs_url = urljoin(gallery_path, core)
anchor = f"<a href=\"{escape(abs_url)}\">{escape(abs_url)}</a>"
new_word = anchor + suffix
words[i] = new_word
@ -115,7 +115,9 @@ def write_feed(posts, filename, params, tagname=None):
de = " ".join(
enrich_msg(
msg,
base_url=params["url"],
gallery_path=urljoin(
params["url"], params.get("gallery_path", "") + "/"
),
accepted_images=params["accepted_images"],
trailing_punctuation=params["trailing_punctuation"],
desc_len_limit=DESC_LEN_LIMIT,