feat: scaffold plain .html pages that need no server config

This commit is contained in:
randogoth 2026-10-11 21:16:45 +03:00
parent 5e2e709496
commit 2ea4f461d3
2 changed files with 31 additions and 22 deletions

View file

@ -35,9 +35,15 @@ def test_the_settings_are_valid_python(tmp_path):
)
assert settings["SITENAME"] == "Signal Bars"
assert settings["PLUGINS"] == ["pelican.plugins.mews"]
# The plugin only touches this suffix, so everything has to be saved under it.
assert settings["ARTICLE_SAVE_AS"].endswith(".xhtml")
assert settings["INDEX_SAVE_AS"].endswith(".xhtml")
# A site that is Mews throughout writes plain .html: servers send that as
# text/html (section 7.1) and index.html is the directory index everywhere.
# The suffix the plugin acts on has to agree with where pages are saved.
assert settings["MEWS_SUFFIX"] == ".html"
assert settings["ARTICLE_SAVE_AS"].endswith(".html")
assert settings["PAGE_SAVE_AS"].endswith(".html")
# Pelican falls back to its own HTML for any direct template the theme
# lacks, and with .html the plugin would choke on it.
assert settings["DIRECT_TEMPLATES"] == ["index"]
assert settings["MARKDOWN"]["output_format"] == "xhtml"
@ -62,11 +68,11 @@ def test_the_scaffolded_site_builds_conforming_pages(tmp_path):
check=False,
)
assert built.returncode == 0, built.stderr
pages = sorted((site / "output").glob("*.xhtml"))
assert [p.name for p in pages] == ["first-post.xhtml", "index.xhtml"]
pages = sorted((site / "output").glob("*.html"))
assert [p.name for p in pages] == ["first-post.html", "index.html"]
for page in pages:
report = validate_file(str(page))
assert report.conforms, "\n".join(str(f) for f in report.failures)
# Section 6.1: the index has to be subscribable.
index = (site / "output" / "index.xhtml").read_text()
assert '<li><a href="first-post.xhtml">' in index
index = (site / "output" / "index.html").read_text()
assert '<li><a href="first-post.html">' in index