Compare commits

..
6 Commits
Author SHA1 Message Date
torbenandClaude Sonnet 5.5 fb4e5aed1f Add Page and SourcePage with lossless reading and source writing
CI / checks (pull_request) Successful in 53s
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 03:55:01 +01:00
torbenandClaude Sonnet 5.5 506bcc458a 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 03:55:01 +01:00
torbenandClaude Sonnet 5.5 6ecdbe856a 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 03:55:01 +01:00
torbenandClaude Sonnet 5.5 cce8afada5 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 03:55:01 +01:00
torbenandClaude Sonnet 5.5 f5f78a972d 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 03:55:01 +01:00
torbenandClaude Sonnet 5.5 2ab447031c 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 03:55:01 +01:00
3 changed files with 1 additions and 33 deletions

No files matched your search

+1 -3
View File
@@ -101,14 +101,12 @@ Gewählte Option: „Dateiname ohne `.md`, zusätzlich als einzige `#`-Zeile“.
* `< > : " / \ | ? * [ ] # ^`, * `< > : " / \ | ? * [ ] # ^`,
* die Folge `%%`, * die Folge `%%`,
* Steuerzeichen sowie U+2028 und U+2029, * 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, * Punkt oder Leerraum am Rand,
* Windows-Gerätenamen, * Windows-Gerätenamen,
* ein leerer oder nicht NFC-normalisierter Titel, * ein leerer oder nicht NFC-normalisierter Titel,
* mehr als 252 Bytes UTF-8 (der Dateiname mit `.md` darf 255 Bytes haben). * mehr als 252 Bytes UTF-8 (der Dateiname mit `.md` darf 255 Bytes haben).
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: 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:
* 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). * 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)). * `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,10 +10,6 @@ _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('<>:"/\\|?*[]#^') _FORBIDDEN_CHARS = frozenset('<>:"/\\|?*[]#^')
_LINE_BREAKS = frozenset("\u2028\u2029") _LINE_BREAKS = frozenset("\u2028\u2029")
_MAX_TITLE_BYTES = 252 _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( _DEVICE_NAMES = frozenset(
{"CON", "PRN", "AUX", "NUL", "CONIN$", "CONOUT$"} {"CON", "PRN", "AUX", "NUL", "CONIN$", "CONOUT$"}
| {f"{name}{digit}" for name in ("COM", "LPT") for digit in "123456789¹²³"} | {f"{name}{digit}" for name in ("COM", "LPT") for digit in "123456789¹²³"}
@@ -43,14 +39,6 @@ class PageTitle:
raise InvalidTitleError(f"invalid title {self.value!r}: {reason}") 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: def _title_problem(title: str) -> str | None:
if not title: if not title:
return "empty" return "empty"
@@ -60,10 +48,6 @@ def _title_problem(title: str) -> str | None:
return "contains a forbidden character" return "contains a forbidden character"
if any(unicodedata.category(c) == "Cc" or c in _LINE_BREAKS for c in title): if any(unicodedata.category(c) == "Cc" or c in _LINE_BREAKS for c in title):
return "contains a control character or line break" 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("."): if title != title.strip() or title.startswith(".") or title.endswith("."):
return "starts or ends with whitespace or a dot" return "starts or ends with whitespace or a dot"
if title.split(".", 1)[0].rstrip(" ").upper() in _DEVICE_NAMES: if title.split(".", 1)[0].rstrip(" ").upper() in _DEVICE_NAMES:
-14
View File
@@ -41,12 +41,6 @@ def test_invalid_id_raises(value: str) -> None:
"Aux-Plan", "Aux-Plan",
"a.b", "a.b",
"x%y", "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: def test_title_with_comma(value: str) -> None:
@@ -102,14 +96,6 @@ def test_title_with_comma(value: str) -> None:
"a" * 253, "a" * 253,
"ä" * 127, "ä" * 127,
"a\ud800b", "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: def test_invalid_title_raises(value: str) -> None: