From 97d12b42d997627be6f33528ba2625bd0378de74 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 6 May 2026 20:55:18 +0300 Subject: feat: flip swap mechanism — Phase 2 (swap_sources.py rewrite) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 2 of the MD-as-primary flip. Inverts swap_sources.py so it activates RST overrides (rst-.rst → .rst, with the matching .md excluded via _md_exclude.txt) for stems listed in docs/_rst_overrides.txt. Changes: - scripts/swap_sources.py: rewritten with inverted rename direction and renamed runtime artifacts (_rst_override_state.json, _md_exclude.txt). CLI flags --swap/--restore/--dry-run/--status kept for compatibility with the Makefile and Read the Docs config. - docs/conf.py: clean up the runtime-artifact references that Phase 1 left pointing at the old _swap_state.json and _swap_exclude.txt names. - scripts/import_myst.py and tests/test_import_myst.py deleted; obsolete after the flip (MD is canonical, no separate import workflow needed). - tests/test_swap_sources.py: rewritten for the new semantics. All 10 tests pass under pytest. Smoke-tested end-to-end on a real worktree page (quick-start): adding the stem to _rst_overrides.txt, --dry-run, --swap, --status, --restore, all behave correctly. State JSON has version 2 (bumped from 1 to surface the incompatibility on rollback if old state lingers). Phase 3 will verify Makefile, .readthedocs.yml, docs/_ext/vyos.py don't reference any of the old names, then mark the PR ready-for-review. Generated by robots https://vyos.io --- docs/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index b5019407..76a00577 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -91,14 +91,14 @@ gettext_uuid = False # This pattern also affects html_static_path and html_extra_path . exclude_patterns = [ u'_build', 'Thumbs.db', '.DS_Store', '_include/vyos-1x', - 'md-*.md', '**/md-*.md', + 'rst-*.rst', '**/rst-*.rst', ] import pathlib _build = pathlib.Path(__file__).parent / '_build' -if (_build / '_swap_state.json').exists() and (_build / '_swap_exclude.txt').exists(): +if (_build / '_rst_override_state.json').exists() and (_build / '_md_exclude.txt').exists(): exclude_patterns.extend( - s for s in (line.strip() for line in (_build / '_swap_exclude.txt').read_text().splitlines()) if s + s for s in (line.strip() for line in (_build / '_md_exclude.txt').read_text().splitlines()) if s ) # The name of the Pygments (syntax highlighting) style to use. -- cgit v1.2.3