fix(wordpress): correctly detect bare credit marker prefix before caption fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OliverGiertz 2026-03-27 08:47:09 +00:00
parent 45c533c674
commit 1a8d0775c7

View file

@ -346,9 +346,10 @@ def _build_attribution_block(article: dict[str, Any]) -> str:
img_meta = _get_image_meta_for_url(meta_json, selected_url) img_meta = _get_image_meta_for_url(meta_json, selected_url)
raw_credit = (img_meta.get("credit") or "").strip() raw_credit = (img_meta.get("credit") or "").strip()
caption_text = (img_meta.get("caption") or "").strip() caption_text = (img_meta.get("caption") or "").strip()
# If credit is just a prefix marker (e.g. "Foto:"), extract the credit # If credit is just a bare marker prefix (e.g. "Foto:", "Bild:"),
# portion from the full caption text instead. # clear it and extract the full credit from the caption text instead.
if raw_credit and not raw_credit.rstrip(":").strip(): _BARE_MARKERS = {"foto", "bild", "credit", "fotograf", "fotografie", "photo", "bildnachweis"}
if raw_credit.endswith(":") and raw_credit[:-1].strip().lower() in _BARE_MARKERS:
raw_credit = "" raw_credit = ""
if raw_credit: if raw_credit:
credit = raw_credit credit = raw_credit