tests: handle inline external URLs and CommonMark fences in doc validators #2421

Open
github-bot wants to merge 1 commit from github-bot/gh-2421 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-27 03:17 UTC · original
ubiquitarianism:fix/docs-validators-fences-urls → main · +115 −11 · 2 files · 1 commits · open

Claimed in the coordination issue as: DOC-VALIDATOR-FENCES-AND-URLS (#1608)

What and why

  • tests/test_docs_repo_paths.py: previously skipped any entire line containing ://, creating a false negative whenever a broken local repo path appeared on the same line as an external link. Mask only inline external Markdown links ([...](scheme://...)) instead.
  • tests/test_docs_repo_paths.py and tests/test_docs_table_ids.py: track CommonMark opening/closing fences (```, ````, ~~~) by marker character and length instead of toggling only on triple backticks, preventing false failures on tilde-fenced or longer-backtick-fenced examples.
  • Add targeted regression tests to both validators.

Tested

  • Verified 6 edge cases fail on unpatched main d1dff7949 and pass with this change.
  • python -I tests/test_docs_repo_paths.py and python -I tests/test_docs_table_ids.py: OK.
  • Full docs validation suite (all tests/test_docs_*.py + tests/test_text_write_line_endings.py + compileall): OK.
  • python -I scripts/check_no_game_data.py: exit 0.

GPUs tested: n/a

AI-assisted: yes (Antigravity gemini-4-neon)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — not a translator rule)
**@⁠Andretuta** on GitHub · 2026-11-27 03:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2421) `ubiquitarianism:fix/docs-validators-fences-urls` → `main` · +115 −11 · 2 files · 1 commits · open Claimed in the coordination issue as: DOC-VALIDATOR-FENCES-AND-URLS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why - `tests/test_docs_repo_paths.py`: previously skipped any entire line containing `://`, creating a false negative whenever a broken local repo path appeared on the same line as an external link. Mask only inline external Markdown links (`[...](scheme://...)`) instead. - `tests/test_docs_repo_paths.py` and `tests/test_docs_table_ids.py`: track CommonMark opening/closing fences (` ``` `, ` ```` `, `~~~`) by marker character and length instead of toggling only on triple backticks, preventing false failures on tilde-fenced or longer-backtick-fenced examples. - Add targeted regression tests to both validators. ### Tested - Verified 6 edge cases fail on unpatched `main` `d1dff7949` and pass with this change. - `python -I tests/test_docs_repo_paths.py` and `python -I tests/test_docs_table_ids.py`: OK. - Full docs validation suite (all `tests/test_docs_*.py` + `tests/test_text_write_line_endings.py` + `compileall`): OK. - `python -I scripts/check_no_game_data.py`: exit 0. GPUs tested: n/a AI-assisted: yes (Antigravity gemini-4-neon) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. *(n/a — not a translator rule)*
Mask only inline external Markdown links instead of skipping entire lines containing
'://' in test_docs_repo_paths.py, and track CommonMark backtick/tilde fences in both
test_docs_repo_paths.py and test_docs_table_ids.py with regression tests.

AI-assisted: Antigravity gemini-4-neon.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:19:54 +00:00
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-27 05:49 UTC · original · approved these changes

Approving. Checked on 43128a9c1, which merges cleanly onto main.

tests/test_docs_repo_paths.py and tests/test_docs_table_ids.py: 8 passed, including the whole-docs checks. That matters here, because the change makes the path check stricter (a URL elsewhere on a line no longer hides the repo paths next to it), and every current page still passes.

Read the diff. The fence tracking follows CommonMark where it matters: a backtick opener's info string may not contain a backtick (so ```inline``` on one line is not a fence), the closer must be the same character, at least as long and followed only by whitespace, and tilde fences and longer backtick fences nest the way the tests show. EXTERNAL_LINK strips only the inline link (angle-bracketed destinations and the three title forms included), so a bare URL in prose no longer hides anything.

Two small things, not blockers. _update_fence and FENCE_OPEN are now copied in both files, so a shared helper module in tests/ would stop them drifting. And lstrip(" \t") accepts a fence at any indentation, while CommonMark makes 4+ spaces an indented code block. That only matters for a fence line inside an indented code block, which the docs don't seem to have.

**@⁠tiguan26** on GitHub · 2026-11-27 05:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2421#pullrequestreview-6084015126) · **approved these changes** Approving. Checked on 43128a9c1, which merges cleanly onto main. `tests/test_docs_repo_paths.py` and `tests/test_docs_table_ids.py`: 8 passed, including the whole-docs checks. That matters here, because the change makes the path check stricter (a URL elsewhere on a line no longer hides the repo paths next to it), and every current page still passes. Read the diff. The fence tracking follows CommonMark where it matters: a backtick opener's info string may not contain a backtick (so ```` ```inline``` ```` on one line is not a fence), the closer must be the same character, at least as long and followed only by whitespace, and tilde fences and longer backtick fences nest the way the tests show. `EXTERNAL_LINK` strips only the inline link (angle-bracketed destinations and the three title forms included), so a bare URL in prose no longer hides anything. Two small things, not blockers. `_update_fence` and `FENCE_OPEN` are now copied in both files, so a shared helper module in `tests/` would stop them drifting. And `lstrip(" \t")` accepts a fence at any indentation, while CommonMark makes 4+ spaces an indented code block. That only matters for a fence line inside an indented code block, which the docs don't seem to have.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2421/head:github-bot/gh-2421'
git switch 'github-bot/gh-2421'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2421'
git switch 'github-bot/gh-2421'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2421'
git switch 'github-bot/gh-2421'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2421'
git switch 'main'
git merge --squash 'github-bot/gh-2421'
git switch 'main'
git merge --ff-only 'github-bot/gh-2421'
git switch 'main'
git merge 'github-bot/gh-2421'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.