Link capitalised Transmodel concept names in documentation #5

Merged
moof merged 0 commits from transmodel-text-links into main 2026-10-21 01:21:01 +00:00
moof commented 2026-10-21 01:16:01 +00:00 (Migrated from code.moof.space)

Requested by Moof · project thread

What

With --transmodel, Transmodel concept names written in capitals in the documentation now link to their Transmodel 6.2 pages, as well as the page-level link added in #2. For example, "A path within a SITE connecting two SITE COMPONENTs, or PATH JUNCTIONs" gets three links.

How terms are matched

  • A run of capitalised words is split into the longest concept names it contains: "STOP PLACE ENTRANCE QUAY" becomes STOP PLACE ENTRANCE + QUAY.
  • A lower-case ending on the last word is read as a plural or typo: ENTITies → ENTITY, FACILITies → FACILITY, PLACEs → PLACE, OPERATOR's → OPERATOR, INTERCHANGe → INTERCHANGE. The link keeps the original text and gets a title naming the concept.
  • Words that aren't concepts (DEPRECATED, ANDed, URL, …) stay plain. Text inside <code>, <pre> and existing links is left alone, so the linking is idempotent.
  • Documentation is linked on the page itself and on its attributes, content-model tree, identity constraints and enumeration values, for declarations in the --transmodel-namespace namespaces.

Catalog fix

The Enterprise Architect page title shows "NAME ALIAS" for renamed concepts. For example, the PATH LINK page is titled "PATH LINK SITE PATH LINK", so #2 recorded names like that and never matched PATH LINK, TRAIN or PATH JUNCTION. The script now takes the name from <title> and lists the 11 aliases separately, so both SITE PATH LINK and PATH LINK resolve. The hand-written element aliases for the train concepts are no longer needed.

Result on NeTEx NX.xsd

  • 68,487 concept links across documentation text, plus 1,445 pages with a page-level concept link (up from 1,433 after the catalog fix).
  • The link markup is kept short (<a class="tm" href="…">, with a title only when the text differs from the concept name). The site grows from 127 MB to 134 MB (about 5%).
  • Links are styled with a dotted underline in the text colour so they don't overwhelm the prose.

Version

0.10.0, because 0.9.0 is taken by #4.

Tests

uv run python -m unittest discover -s tests: 44 tests pass, including two new ones for term matching and documentation linking.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AmFvj38A6ceghEnxPGvprJ

<!-- claude-projects-attribution --> _Requested by **Moof** · [project thread](https://claude.ai/code/project/chan_01BmPQxcG1UuS21Gfai9Zcdh?thread=cmsg_01BmPQxcG1UuS21Gfai9ZcdhCwVSYkTqHErZYyHGU73Pki)_ ## What With `--transmodel`, Transmodel concept names written in capitals in the documentation now link to their Transmodel 6.2 pages, as well as the page-level link added in #2. For example, "A path within a SITE connecting two SITE COMPONENTs, or PATH JUNCTIONs" gets three links. ## How terms are matched - A run of capitalised words is split into the longest concept names it contains: "STOP PLACE ENTRANCE QUAY" becomes STOP PLACE ENTRANCE + QUAY. - A lower-case ending on the last word is read as a plural or typo: `ENTITies` → ENTITY, `FACILITies` → FACILITY, `PLACEs` → PLACE, `OPERATOR's` → OPERATOR, `INTERCHANGe` → INTERCHANGE. The link keeps the original text and gets a `title` naming the concept. - Words that aren't concepts (DEPRECATED, ANDed, URL, …) stay plain. Text inside `<code>`, `<pre>` and existing links is left alone, so the linking is idempotent. - Documentation is linked on the page itself and on its attributes, content-model tree, identity constraints and enumeration values, for declarations in the `--transmodel-namespace` namespaces. ## Catalog fix The Enterprise Architect page title shows "NAME ALIAS" for renamed concepts. For example, the PATH LINK page is titled "PATH LINK SITE PATH LINK", so #2 recorded names like that and never matched PATH LINK, TRAIN or PATH JUNCTION. The script now takes the name from `<title>` and lists the 11 aliases separately, so both SITE PATH LINK and PATH LINK resolve. The hand-written element aliases for the train concepts are no longer needed. ## Result on NeTEx `NX.xsd` - 68,487 concept links across documentation text, plus 1,445 pages with a page-level concept link (up from 1,433 after the catalog fix). - The link markup is kept short (`<a class="tm" href="…">`, with a title only when the text differs from the concept name). The site grows from 127 MB to 134 MB (about 5%). - Links are styled with a dotted underline in the text colour so they don't overwhelm the prose. ## Version 0.10.0, because 0.9.0 is taken by #4. ## Tests `uv run python -m unittest discover -s tests`: 44 tests pass, including two new ones for term matching and documentation linking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01AmFvj38A6ceghEnxPGvprJ
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Reference4PT/prettyxsd!5
No description provided.