diff --git a/article_server.py b/article_server.py
index e936df6..e22d6b3 100644
--- a/article_server.py
+++ b/article_server.py
@@ -2828,21 +2828,81 @@ def _resize_image(data, output_path):
img.save(output_path, "JPEG", quality=85, dpi=(72, 72))
-def _publish_to_joomla(filepath, rubrik_id):
- """Artikel via Joomla-API veroffentlichen."""
+def _publish_to_joomla(filepath, rubrik_id, allow_live=False):
+ """Artikel via Joomla-API veroffentlichen.
+
+ Nutzt das gleiche flache Payload-Format wie _handle_publish()
+ (Joomla 5/6 API akzeptiert NICHT den JSON:API-Wrapper bei POST).
+ """
import requests
with open(filepath, encoding="utf-8") as f:
html = f.read()
+
+ # ── Metadaten extrahieren ──
title_match = re.search(r"
(.*?)", html)
title = title_match.group(1) if title_match else "Unbekannt"
+
+ alias = re.sub(r'[^a-z0-9]+', '-', title.lower().strip())[:100]
+
body_match = re.search(r"(.*?)", html, re.DOTALL)
- body = body_match.group(1).strip() if body_match else html
- payload = {"data": {"type": "articles", "attributes": {
- "title": title, "alias": title.lower().replace(" ", "-")[:100],
- "articletext": body, "state": 1, "catid": rubrik_id, "language": "de-DE"
- }}}
+ article_body = body_match.group(1).strip() if body_match else html
+
+ # ── Interne Marker entfernen (wie _handle_publish) ──
+ article_body = re.sub(r']*>.*?
\s*', '', article_body, flags=re.DOTALL)
+ article_body = re.sub(r']*>.*?
\s*', '', article_body, flags=re.DOTALL)
+
+ # ── Read-More-Split für introtext/fulltext ──
+ introtext = ""
+ fulltext = article_body.strip()
+ sr_match = re.search(r'
', article_body, re.IGNORECASE)
+ if sr_match:
+ split_idx = sr_match.start()
+ introtext = article_body[:split_idx].strip()
+ fulltext = article_body[split_idx:].strip()
+ fulltext = re.sub(r'^
\s*', '', fulltext)
+
+ # ── Meta-Description & Keywords ──
+ meta_desc_match = re.search(r'