Compare commits

..
6 Commits
Author SHA1 Message Date
torbenandClaude Sonnet 5.5 be103e1aa0 Add Page and SourcePage with lossless reading and source writing
CI / checks (pull_request) Successful in 58s
Pages keep their original bytes; fields and sections are views. Source
pages are read strictly and written in a fixed field order.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 06:44:01 +01:00
torbenandClaude Sonnet 5.5 c4c388c036 Add fact time intervals with strict point parsing
FactTime validates and compares intervals in UTC; dates cover the
whole UTC day. parse_point/format_point accept only strict forms.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 06:44:01 +01:00
torbenandClaude Sonnet 5.5 ea91034d84 Add page identity and frontmatter domain types
PageId (UUIDv7) and PageTitle validate on construction; frontmatter is
split losslessly, read as text-only YAML without anchors or duplicate
keys, and written canonically. All page errors live in domain/errors.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 06:44:01 +01:00
torbenandClaude Sonnet 5.5 cc893be3d5 Add section splitting and wikilink detection to the domain
Sections are split at level 1 and 2 headings outside code and comments,
each with a content hash. Wikilinks are found outside code and comments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 06:44:01 +01:00
torbenandClaude Sonnet 5.5 b6a00ed972 Link page format ADR from ADR 0014 and 0015, extend glossary
Clarify aliases in ADR 0014, link fields per source in ADR 0015, set date. Add section, head, title and authority form to the glossary.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 06:44:01 +01:00
torbenandClaude Sonnet 5.5 a639e5240e Add ADR for page format and source page fields
Fills in ADR 0014 and 0015: lossless reading, title rule, sections,
hash, links, source page fields and fact time.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 06:44:01 +01:00
3 changed files with 33 additions and 1 deletions

No files matched your search

+3 -1
View File
@@ -101,12 +101,14 @@ Gewählte Option: „Dateiname ohne `.md`, zusätzlich als einzige `#`-Zeile“.
* `< > : " / \ | ? * [ ] # ^`,
* die Folge `%%`,
* Steuerzeichen sowie U+2028 und U+2029,
* unsichtbare Formatzeichen (Unicode-Kategorie Cf, etwa U+200B, U+FEFF, Richtungszeichen); erlaubt bleiben die Verbinder U+200C und U+200D, die manche Schriften und Emojis brauchen, und die Tag-Zeichen von Regionalflaggen,
* die Endung `.md`, auch in anderer Schreibweise,
* Punkt oder Leerraum am Rand,
* Windows-Gerätenamen,
* ein leerer oder nicht NFC-normalisierter Titel,
* mehr als 252 Bytes UTF-8 (der Dateiname mit `.md` darf 255 Bytes haben).
Das Komma ist erlaubt. Neue Seiten tragen den Titel wörtlich als einzige `#`-Zeile; der Code erzeugt sie aus dem Dateinamen. Die Originalform („Was ist X?“) steht in `aliases`. Gelesen wird tolerant: Eine fehlende oder abweichende `#`-Zeile ist kein Fehler, das meldet später der Lint. Verworfen:
Das Komma ist erlaubt. Unsichtbare Zeichen sind verboten, weil zwei Titel sonst gleich aussehen und doch verschieden sind. Die Endung `.md` ist verboten, weil Obsidian `[[README.md]]` als Link auf die Datei `README.md` liest, eine Seite dieses Titels aber `README.md.md` hieße ([Links](https://obsidian.md/help/links)); die Originalform steht dann in `aliases`. Neue Seiten tragen den Titel wörtlich als einzige `#`-Zeile; der Code erzeugt sie aus dem Dateinamen. Die Originalform („Was ist X?“) steht in `aliases`. Gelesen wird tolerant: Eine fehlende oder abweichende `#`-Zeile ist kein Fehler, das meldet später der Lint. Verworfen:
* Nur der Dateiname: Außerhalb von Obsidian ist die Seite titellos, und es widerspricht dem [Google-Style-Guide](https://google.github.io/styleguide/docguide/style.html) und [markdownlint MD041](https://github.com/DavidAnson/markdownlint/blob/main/doc/md041.md).
* `title:` im Frontmatter: Obsidian nutzt es weder als Linkziel noch zur Anzeige ([Links](https://obsidian.md/help/links), [Eigenschaften](https://obsidian.md/help/properties)).
+16
View File
@@ -10,6 +10,10 @@ _ID_RE = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-
_FORBIDDEN_CHARS = frozenset('<>:"/\\|?*[]#^')
_LINE_BREAKS = frozenset("\u2028\u2029")
_MAX_TITLE_BYTES = 252
# Invisible format characters (Cf) are forbidden, except the joiners that some
# scripts and emoji sequences need and the tag characters of subdivision flags.
_ALLOWED_FORMAT = frozenset("\u200c\u200d")
_TAGS = range(0xE0020, 0xE0080)
_DEVICE_NAMES = frozenset(
{"CON", "PRN", "AUX", "NUL", "CONIN$", "CONOUT$"}
| {f"{name}{digit}" for name in ("COM", "LPT") for digit in "123456789¹²³"}
@@ -39,6 +43,14 @@ class PageTitle:
raise InvalidTitleError(f"invalid title {self.value!r}: {reason}")
def _invisible(char: str) -> bool:
return (
unicodedata.category(char) == "Cf"
and char not in _ALLOWED_FORMAT
and ord(char) not in _TAGS
)
def _title_problem(title: str) -> str | None:
if not title:
return "empty"
@@ -48,6 +60,10 @@ def _title_problem(title: str) -> str | None:
return "contains a forbidden character"
if any(unicodedata.category(c) == "Cc" or c in _LINE_BREAKS for c in title):
return "contains a control character or line break"
if any(_invisible(c) for c in title):
return "contains an invisible character"
if title.casefold().endswith(".md"):
return "ends with .md, which Obsidian reads as the file extension"
if title != title.strip() or title.startswith(".") or title.endswith("."):
return "starts or ends with whitespace or a dot"
if title.split(".", 1)[0].rstrip(" ").upper() in _DEVICE_NAMES:
+14
View File
@@ -41,6 +41,12 @@ def test_invalid_id_raises(value: str) -> None:
"Aux-Plan",
"a.b",
"x%y",
"md",
"notes.mdx",
"a.md b",
"Familie 👨" + chr(0x200D) + "👩",
"Mi" + chr(0x200C) + "zan",
"🏴" + "".join(chr(0xE0000 + ord(c)) for c in "gbeng") + chr(0xE007F),
],
)
def test_title_with_comma(value: str) -> None:
@@ -96,6 +102,14 @@ def test_title_with_comma(value: str) -> None:
"a" * 253,
"ä" * 127,
"a\ud800b",
"README.md",
"notes.MD",
"x.Md",
"a" + chr(0x200B) + "b",
chr(0xFEFF) + "a",
"a" + chr(0x202E) + "b",
"a" + chr(0x00AD) + "b",
"a" + chr(0x2060) + "b",
],
)
def test_invalid_title_raises(value: str) -> None: