Fix memoir image delivery and Android rendering

This commit is contained in:
Kevin
2026-03-11 10:06:12 +08:00
parent 0970cb7408
commit a76cf8da18
23 changed files with 537 additions and 51 deletions

View File

@@ -1,13 +1,16 @@
import re
from typing import Any
PLACEHOLDER_RE = re.compile(r"\{\{\{\{IMAGE:(.*?)\}\}\}\}")
PLACEHOLDER_RE = re.compile(
r"\{\{\{\{IMAGE:(.*?)\}\}\}\}|\{\{IMAGE:(.*?)\}\}",
re.DOTALL,
)
def parse_image_placeholders(content: str, max_images: int) -> list[dict[str, Any]]:
items: list[dict[str, Any]] = []
for match in PLACEHOLDER_RE.finditer(content or ""):
description = match.group(1).strip()
description = (match.group(1) or match.group(2) or "").strip()
if not description:
continue
items.append(