article mode: inject the page title as # heading, jargon loanword rule

When the render would inject the page title as an h1 (markdown.has_h1 is
False for the body), an article job's text carries the same '# {title}'
line: the title translates in document context and the opening paragraphs
see the heading (works both ways). The heading's pair in the decomposed
result becomes the title fragment — heading text only, pure prose, never
stored as a body chunk; a demoted or merged heading skips the title,
which stays pending for a scoped title job. The job covers the title key
so it is not double-dispatched afterwards.

Prompt: prefer established technical loanwords with English roots over
forced localizations (frontend -> frontti in Finnish, not etupääte).

Verified offline (title extraction, demoted-heading skip, no-injection
path) and live against ollama qwen3.8:27b: the standalone title job gave
'Alkuun pääseminen', the article job then overwrote it with the
in-context 'Aloitus' matching the body's translated heading.
This commit is contained in:
2026-09-21 01:07:54 +00:00
parent 37e9ab2cd2
commit 859d11491d
4 changed files with 76 additions and 19 deletions
+2 -1
View File
@@ -83,7 +83,8 @@ Rules:
- The text uses extended Markdown (container fences ::: name, {...} attributes, task lists, footnotes and more): all of it is formatting syntax and must be preserved exactly — only the human-readable text is translated.
- Newlines are significant: a single newline inside a paragraph renders as an actual line break, so keep the line structure exactly and never join, split or rewrap lines.
- Preserve the block structure exactly: same blocks separated by blank lines, same headings (# levels), lists, code fences, images and links; do not merge, split, add, drop or reorder blocks.
- Never translate or alter URLs, image destinations, code, or {...} placeholders. Image alt texts and link texts ARE translated."""
- Never translate or alter URLs, image destinations, code, or {...} placeholders. Image alt texts and link texts ARE translated.
- Prefer established technical loanwords with English roots over forced localizations — the jargon professionals actually use (in Finnish "frontend" becomes "frontti", not "etupääte")."""
def article_prompt(target: str, doc: str) -> str: