Skip to content

Commit 69cc006

Browse files
authored
Merge pull request #260 from eccenca/feature/zensical-addons
Expose every tools script as a dec-tool subcommand
2 parents 1b969f4 + a6911b9 commit 69cc006

9 files changed

Lines changed: 419 additions & 77 deletions

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ repos:
1111
pass_filenames: false
1212

1313
- id: nav-drift
14-
name: check:nav
15-
entry: task check:nav
14+
name: check:navigation
15+
entry: task check:navigation
1616
language: python
1717
pass_filenames: false
18-
files: '(^docs/.*\.pages$|^nav\.yml$|^tools/build_nav\.py$)'
18+
files: '(^docs/.*\.pages$|^nav\.yml$|^tools/build_navigation\.py$)'

README.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,19 @@ check** - the build fails if any of it regresses:
4848
| `tablesort`, `glightbox` | vendored under `docs/assets/`; `tools/localize_bundle_assets.py` rewrites the CDN URLs Zensical bakes into its JS bundle |
4949
| Redirects | static stubs under `docs/` |
5050
| Comment opt-out | `overrides/partials/comments.html` |
51-
| Tag listings ([#38](https://github.com/zensical/backlog/issues/38)) | `tools/render_tag_listings.py` - **temporary**, see `tasks/spec.md` |
52-
| Tag chip links ([#38](https://github.com/zensical/backlog/issues/38)) | `overrides/partials/tags.html` - **temporary**, same removal trigger |
53-
54-
The tag-listing renderer expands the `<!-- material/tags -->` markers on `/tags/` and
55-
`/tutorials/` after the build, and the `tags.html` override links each page's tag chips to
56-
its section there. Both are deliberately throwaway: the Markdown sources still use
57-
Material's own marker syntax and Zensical's stock template already knows how to render a
58-
linked chip - it just has no listing to point at yet. When Zensical ships listings the
59-
feature works natively, the renderer prints a banner telling you to delete it, and the
60-
override can go with it.
61-
62-
The two build the anchor slug independently - MiniJinja in the template, Python in the
63-
renderer - so `check_zensical_output.py` asserts that every chip anchor resolves on
64-
`/tags/`. That check is what turns a slug mismatch into a failed build instead of 703 dead
65-
links.
66-
67-
`task check:nav` additionally fails if `nav.yml` no longer matches the `docs/**/.pages`
68-
files, which remain the source of truth for navigation (`task nav` regenerates it).
51+
52+
Tag listings and the links from each page's tag chips to them are **native** as of
53+
Zensical 0.0.58. The local stand-ins for both - a post-build renderer and a `tags.html`
54+
partial override - are gone; the Markdown sources still carry Material's own
55+
`<!-- material/tags -->` markers, which Zensical now expands itself.
56+
57+
`check-zensical-output` keeps guarding the result: it asserts that tag chips link
58+
somewhere at all and that every anchor they point at exists on `/tags/`. A slug mismatch
59+
between a chip and its listing would otherwise ship as hundreds of dead links rather than
60+
fail the build.
61+
62+
`task check:navigation` additionally fails if `nav.yml` no longer matches the `docs/**/.pages`
63+
files, which remain the source of truth for navigation (`task update:navigation` regenerates it).
6964

7065
See `tasks/handoff.md` for the full migration notes.
7166

Taskfile.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,39 +63,22 @@ tasks:
6363
cmds:
6464
- task: check:links
6565
- task: check:rumdl
66-
- task: check:nav
66+
- task: check:navigation
6767
- task: check:output
6868

69-
check:nav:
69+
check:navigation:
7070
desc: Fail if nav.yml is out of sync with the docs/**/.pages files
7171
deps:
7272
- install
7373
cmds:
74-
- |
75-
expected=$(mktemp)
76-
trap 'rm -f "$expected"' EXIT
77-
poetry run python tools/build_nav.py > "$expected"
78-
if ! diff -u nav.yml "$expected"; then
79-
echo
80-
echo "nav.yml is out of date with respect to the docs/**/.pages files."
81-
echo "Run 'task nav' and commit the result."
82-
exit 1
83-
fi
84-
echo "nav.yml matches the .pages files."
74+
- poetry run dec-tool build-navigation --check
8575

8676
check:output:
8777
desc: Fail if a feature we reimplemented for Zensical regressed in the build
8878
deps:
8979
- build
9080
cmds:
91-
- poetry run python tools/check_zensical_output.py site
92-
93-
nav:
94-
desc: Regenerate nav.yml from the docs/**/.pages files
95-
deps:
96-
- install
97-
cmds:
98-
- poetry run python tools/build_nav.py > nav.yml
81+
- poetry run dec-tool check-zensical-output
9982

10083
check:links:
10184
desc: Check outgoing links
@@ -136,7 +119,7 @@ tasks:
136119
# Zensical bakes unpkg.com URLs into its JS bundle; rewrite them to the
137120
# vendored copies. Part of building, not of checking - without it the
138121
# published site issues third-party requests.
139-
- poetry run python tools/localize_bundle_assets.py site
122+
- poetry run dec-tool localize-bundle-assets
140123

141124
serve:
142125
desc: Serve the page on localhost with live reload (no post-build steps)
@@ -265,6 +248,13 @@ tasks:
265248
PATHS: ./docs/build/integrations/index.md
266249
ignore_error: true
267250

251+
update:navigation:
252+
desc: Regenerate nav.yml from the docs/**/.pages files
253+
deps:
254+
- install
255+
cmds:
256+
- poetry run dec-tool build-navigation
257+
268258
public:versions:
269259
desc: List public documentation versions
270260
deps:

0 commit comments

Comments
 (0)