P-0000: Projekt-ID und Format 1 in Vorlagen und init.sh, Prüfskript (offen als Hinweis), Viewer-Marke, Tests vorlage2projektid

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-03 10:32:52 +01:00
parent 41354ef448
commit 8c4594fe53
13 changed files with 285 additions and 74 deletions

View File

@ -7,7 +7,7 @@
import { devRoadmap } from "./api";
import { loadTestData, lastRun, td } from "./testdata.svelte";
import { t } from "./i18n.svelte";
import { bullets, isNewerFormat, formatVersion, VIEWER_FORMAT, parseDoc, parseTests, prose, statusRows, STATUSES, tableOf, todoItems, versions, type Bullet, type Doc, type Process } from "./roadmap";
import { bullets, isNewerFormat, formatVersion, projectId, VIEWER_FORMAT, parseDoc, parseTests, prose, statusRows, STATUSES, tableOf, todoItems, versions, type Bullet, type Doc, type Process } from "./roadmap";
let { title = "", path = "" }: { title?: string; path?: string } = $props();
let doc = $state<Doc | null>(null);
@ -152,6 +152,7 @@
<div class="titles">
<h1>{title || t("rmTitle")}</h1>
{#if path}<span class="badge" title={path}>{path}</span>{/if}
{#if doc && projectId(doc.head)}<span class="badge" title="Projekt-ID" data-testid="rm-pid">{projectId(doc.head) === "offen" ? "Projekt-ID offen" : projectId(doc.head)}</span>{/if}
</div>
<div class="tools">
{#if doc?.nextId}<small title={t("rmNextIdTip")}>{t("rmNextId")} #{doc.nextId}</small>{/if}

View File

@ -18,6 +18,12 @@ export function formatVersion(head: string): number {
return /^\d+$/.test(m[1]) ? Number(m[1]) : NaN;
}
/** `Projekt-ID: P-nnnn` oder `offen` im Kopf; sonst null */
export function projectId(head: string): string | null {
const m = head.match(/Projekt-ID:\s*(P-\d{4}|offen)(?![\w-])/);
return m ? m[1] : null;
}
/** Die Datei ist neuer, als dieser Viewer sie versteht */
export function isNewerFormat(head: string): boolean {
return formatVersion(head) > VIEWER_FORMAT;