2026-10-11 15:05:42 +03:00
|
|
|
"""The packaged copies of the stylesheet and the DTD, against their originals.
|
|
|
|
|
|
|
|
|
|
The validator has to find both when it is installed as a wheel with nothing but
|
refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
2026-10-13 12:29:23 +03:00
|
|
|
the package on disk, so validator/mews/data holds copies. They must not drift.
|
2026-10-11 15:05:42 +03:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from importlib import resources
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
|
|
|
|
COPIES = {
|
refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
2026-10-13 12:29:23 +03:00
|
|
|
"mews-0.1.css": ROOT / "spec" / "mews-0.1.css",
|
|
|
|
|
"mews-0.1.dtd": ROOT / "spec" / "mews-0.1.dtd",
|
2026-10-11 15:05:42 +03:00
|
|
|
}
|
|
|
|
|
|
2026-10-11 20:55:07 +03:00
|
|
|
# The Pelican plugin is a separate distributable package, so it carries its own
|
|
|
|
|
# copy of the DTD rather than importing one. It shipped a hand-written
|
|
|
|
|
# placeholder for a while, which silently stripped tables, ordered lists, forms
|
|
|
|
|
# and the body variant class out of every page it produced.
|
|
|
|
|
PLUGIN_DTD = ROOT / "pelican-mews" / "pelican" / "plugins" / "mews" / "dtd" / "mews.dtd"
|
|
|
|
|
|
2026-10-11 15:05:42 +03:00
|
|
|
|
|
|
|
|
def test_packaged_copies_match_the_originals():
|
|
|
|
|
for name, original in COPIES.items():
|
|
|
|
|
packaged = resources.files("mews.data").joinpath(name).read_bytes()
|
|
|
|
|
assert packaged == original.read_bytes(), (
|
refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
2026-10-13 12:29:23 +03:00
|
|
|
f"validator/mews/data/{name} differs from {original}. "
|
|
|
|
|
"Copy the original over it."
|
2026-10-11 15:05:42 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_the_spec_quotes_the_same_stylesheet():
|
|
|
|
|
"""SPEC.md 5.1 prints the stylesheet in full; it has to be the same file."""
|
refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
2026-10-13 12:29:23 +03:00
|
|
|
spec = (ROOT / "spec" / "SPEC.md").read_text()
|
2026-10-11 15:05:42 +03:00
|
|
|
quoted = spec.split("```css\n", 1)[1].split("```", 1)[0]
|
refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
2026-10-13 12:29:23 +03:00
|
|
|
assert quoted.strip() == (ROOT / "spec" / "mews-0.1.css").read_text().strip()
|
2026-10-11 20:55:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_the_pelican_plugin_bundles_the_real_dtd():
|
refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
2026-10-13 12:29:23 +03:00
|
|
|
canonical = (ROOT / "spec" / "mews-0.1.dtd").read_bytes()
|
2026-10-11 20:55:07 +03:00
|
|
|
assert PLUGIN_DTD.read_bytes() == canonical, (
|
refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
2026-10-13 12:29:23 +03:00
|
|
|
f"{PLUGIN_DTD} differs from spec/mews-0.1.dtd. Copy the original over it."
|
2026-10-11 20:55:07 +03:00
|
|
|
)
|