Fix gallery_path
This commit is contained in:
parent
a372df0951
commit
68a5b2be65
@ -550,6 +550,7 @@ if __name__ == "__main__":
|
|||||||
updated += writepage(tpl, tl, tc, cfg["page"],
|
updated += writepage(tpl, tl, tc, cfg["page"],
|
||||||
paginate=True if new_posts is None else False)
|
paginate=True if new_posts is None else False)
|
||||||
cfg["rss"]["accepted_images"] = cfg["post"]["accepted_images"]
|
cfg["rss"]["accepted_images"] = cfg["post"]["accepted_images"]
|
||||||
|
cfg["rss"]["gallery_path"] = cfg["post"]["gallery"]["path_to_fullsize"]
|
||||||
if cfg["rss"]["enabled"]:
|
if cfg["rss"]["enabled"]:
|
||||||
# ensure output directory for feeds exists
|
# ensure output directory for feeds exists
|
||||||
if not os.path.exists("feeds"):
|
if not os.path.exists("feeds"):
|
||||||
|
@ -43,7 +43,7 @@ def _is_image_token(token: str, extensions):
|
|||||||
def enrich_msg(
|
def enrich_msg(
|
||||||
lines,
|
lines,
|
||||||
accepted_images=[],
|
accepted_images=[],
|
||||||
base_url="",
|
gallery_path="",
|
||||||
trailing_punctuation="",
|
trailing_punctuation="",
|
||||||
desc_len_limit=-1,
|
desc_len_limit=-1,
|
||||||
):
|
):
|
||||||
@ -66,7 +66,7 @@ def enrich_msg(
|
|||||||
words[i] = new_word
|
words[i] = new_word
|
||||||
elif _is_image_token(core, accepted_images):
|
elif _is_image_token(core, accepted_images):
|
||||||
suffix = word[len(core):]
|
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>"
|
anchor = f"<a href=\"{escape(abs_url)}\">{escape(abs_url)}</a>"
|
||||||
new_word = anchor + suffix
|
new_word = anchor + suffix
|
||||||
words[i] = new_word
|
words[i] = new_word
|
||||||
@ -115,7 +115,9 @@ def write_feed(posts, filename, params, tagname=None):
|
|||||||
de = " ".join(
|
de = " ".join(
|
||||||
enrich_msg(
|
enrich_msg(
|
||||||
msg,
|
msg,
|
||||||
base_url=params["url"],
|
gallery_path=urljoin(
|
||||||
|
params["url"], params.get("gallery_path", "") + "/"
|
||||||
|
),
|
||||||
accepted_images=params["accepted_images"],
|
accepted_images=params["accepted_images"],
|
||||||
trailing_punctuation=params["trailing_punctuation"],
|
trailing_punctuation=params["trailing_punctuation"],
|
||||||
desc_len_limit=DESC_LEN_LIMIT,
|
desc_len_limit=DESC_LEN_LIMIT,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user