diff --git a/.github/scripts/site-check.py b/.github/scripts/site-check.py
deleted file mode 100644
index b25c1bf53..000000000
--- a/.github/scripts/site-check.py
+++ /dev/null
@@ -1,464 +0,0 @@
-# Copied from the new-repo templates into every docs repo. Repos run different ruff
-# settings, so their formatter leaves this file as it is: lint it, do not reformat it.
-# fmt: off
-"""Post-build check of a Zensical site: the rules `zensical build --strict` does not enforce.
-
-usage: python3 -I .github/scripts/site-check.py
",
+ ),
+ (
+ " ",
+ ),
+ (
+ " ",
+ ),
+ (
+ " ",
+ ),
+ ];
+ for (from, to, line) in cases {
+ let site = Site::new();
+ site.edit("site/index.html", from, to);
+ red(
+ &site,
+ &format!("index.html: {line} in the page body hides everything"),
+ );
+ }
+}
+
+#[test]
+fn copy_buttons() {
+ let site = Site::new();
+ site.edit(
+ "site/index.html",
+ "data-md-copy-url=\"index.md\"",
+ "data-md-copy-url=\"gone.md\"",
+ );
+ red(&site, "index.html: Copy as Markdown points at 'gone.md'");
+ let site = Site::new();
+ site.edit(
+ "site/guide/index.html",
+ "data-md-copy-url=\"index.md\"",
+ "class=\"x\"",
+ );
+ red(
+ &site,
+ "guide/index.html: content.action.copy is on but the page has no Copy as Markdown button",
+ );
+}
+
+#[test]
+fn home_page_must_be_a_content_page() {
+ let site = Site::new();
+ site.edit("site/index.html", "class=\"md-content\"", "class=\"other\"");
+ red(&site, "index.html is not a content page");
+ let site = Site::new();
+ site.remove("site/index.html");
+ let (code, out) = site.run();
+ assert_eq!(code, 1);
+ assert!(
+ out.ends_with("site: no index.html (did the build run?)\n"),
+ "{out}"
+ );
+}
+
+#[test]
+fn site_url_and_its_prefix() {
+ let site = Site::new();
+ site.edit(
+ "zensical.toml",
+ "https://geiserx.github.io/OwnGenome/",
+ "ftp://x/",
+ );
+ red(&site, "site_url 'ftp://x/' is not an absolute http(s) URL");
+ let site = Site::new();
+ site.edit(
+ "zensical.toml",
+ "https://geiserx.github.io/OwnGenome/",
+ "http://[::1/",
+ );
+ red(&site, "site_url 'http://[::1/' is not a valid URL");
+ // No site_url: the canonical link stands in, with the same prefix.
+ let site = Site::new();
+ site.edit(
+ "zensical.toml",
+ "site_url = \"https://geiserx.github.io/OwnGenome/\"",
+ "",
+ );
+ let (code, out) = site.run();
+ assert_eq!(code, 0, "{out}");
+ assert!(out.ends_with("prefix /OwnGenome/\n"), "{out}");
+ // Neither: an error, not a check that cannot fire.
+ site.edit(
+ "site/index.html",
+ "",
+ "",
+ );
+ red(
+ &site,
+ "no site_url in zensical.toml and no canonical link in index.html",
+ );
+}
+
+#[test]
+fn redirect_stubs() {
+ let site = Site::new();
+ site.remove("site/old");
+ red(
+ &site,
+ "redirect_maps 'old.md': no redirect stub at old/index.html",
+ );
+ // A stub's own links are checked.
+ let site = Site::new();
+ site.edit(
+ "site/old/index.html",
+ "href=\"../guide/\">",
+ "href=\"../nowhere/\">",
+ );
+ red(
+ &site,
+ "old/index.html: ../nowhere/ -> missing nowhere/index.html",
+ );
+ let site = Site::new();
+ site.edit(
+ "zensical.toml",
+ "[project.plugins.redirects.redirect_maps]\n\"old.md\" = \"guide.md\"",
+ "[project.plugins.redirects]\nredirect_maps = 3",
+ );
+ red(
+ &site,
+ "zensical.toml: redirects redirect_maps must be a table, got 3",
+ );
+}
+
+#[test]
+fn config_names_zensical_ignores() {
+ let cases = [
+ (
+ "[project.plugins.search]",
+ "[project.plugins.redirect]",
+ "plugin 'redirect' is unknown to Zensical",
+ ),
+ (
+ "\"navigation.tabs\"",
+ "\"search.suggest\"",
+ "feature 'search.suggest' is unknown to the Zensical UI",
+ ),
+ (
+ "variant = \"modern\"",
+ "variant = \"fancy\"",
+ "theme.variant 'fancy' is not modern or classic",
+ ),
+ (
+ "features = [\"navigation.tabs\", \"content.action.copy\"]",
+ "features = \"navigation.tabs\"",
+ "theme.features must be a list of strings, got 'navigation.tabs'",
+ ),
+ ];
+ for (from, to, line) in cases {
+ let site = Site::new();
+ site.edit("zensical.toml", from, to);
+ red(&site, line);
+ }
+ let site = Site::new();
+ site.edit(
+ "zensical.toml",
+ "features = [\"navigation.tabs\", \"content.action.copy\"]",
+ "features = [\"navigation.tabs\", 1, \"\u{2013}\"]",
+ );
+ red(
+ &site,
+ "theme.features must be a list of strings, got ['navigation.tabs', 1, '\u{2013}']",
+ );
+ let site = Site::new();
+ site.edit(
+ "zensical.toml",
+ "site_name = \"Demo\"",
+ "site_name = \"Demo\"\nplugins = \"search\"",
+ );
+ site.edit(
+ "zensical.toml",
+ "[project.plugins.search]\n\n[project.plugins.llmstxt.sections]\nDocs = [\"*.md\"]\n\n[project.plugins.redirects.redirect_maps]\n\"old.md\" = \"guide.md\"",
+ "",
+ );
+ red(
+ &site,
+ "zensical.toml: plugins is a str, not a table or a list",
+ );
+ let site = Site::new();
+ site.edit("site/index.html", "stylesheets/modern/", "stylesheets/");
+ red(
+ &site,
+ "index.html does not load the modern stylesheet although theme.variant is modern",
+ );
+}
+
+#[test]
+fn plugins_in_list_form() {
+ let site = Site::new();
+ site.edit(
+ "zensical.toml",
+ "site_name = \"Demo\"",
+ "site_name = \"Demo\"\nplugins = [\"search\", { \"material/llmstxt\" = {} }, 3]",
+ );
+ site.edit(
+ "zensical.toml",
+ "[project.plugins.search]\n\n[project.plugins.llmstxt.sections]\nDocs = [\"*.md\"]\n\n[project.plugins.redirects.redirect_maps]\n\"old.md\" = \"guide.md\"",
+ "",
+ );
+ red(
+ &site,
+ "zensical.toml: plugins entry 3 is neither a name nor a one-entry table",
+ );
+ site.remove("site/llms.txt");
+ red(
+ &site,
+ "llmstxt plugin is configured but site/llms.txt was not written",
+ );
+}
+
+#[test]
+fn llms_txt_only_when_the_plugin_is_on() {
+ let site = Site::new();
+ site.remove("site/llms.txt");
+ red(
+ &site,
+ "llmstxt plugin is configured but site/llms.txt was not written",
+ );
+ site.edit(
+ "zensical.toml",
+ "[project.plugins.llmstxt.sections]",
+ "[project.plugins.llmstxt]\nenabled = false\n[project.plugins.llmstxt.sections]",
+ );
+ let (code, out) = site.run();
+ assert_eq!(code, 0, "{out}");
+}
+
+#[test]
+fn config_that_cannot_be_read() {
+ let site = Site::new();
+ site.remove("zensical.toml");
+ red(&site, "zensical.toml: config file not found");
+ let site = Site::new();
+ site.write("zensical.toml", "[project\n");
+ red(&site, "zensical.toml: not valid TOML");
+ let site = Site::new();
+ site.write("zensical.toml", "[other]\nx = 1\n");
+ red(
+ &site,
+ "zensical.toml: no [project] table, so no config check can run",
+ );
+}
+
+#[test]
+fn usage() {
+ let mut out = Vec::new();
+ let mut err = Vec::new();
+ assert_eq!(site_check::cli(&[], &mut out, &mut err), 2);
+ assert!(
+ String::from_utf8(err)
+ .unwrap()
+ .starts_with("usage: og dev site-check")
+ );
+}
diff --git a/rust/crates/og-render/src/chapters.rs b/rust/crates/og-render/src/chapters.rs
index 92ace64e9..7f468bead 100644
--- a/rust/crates/og-render/src/chapters.rs
+++ b/rust/crates/og-render/src/chapters.rs
@@ -171,25 +171,25 @@ pub fn writer(sid: &str) -> Option<(TextFn, HtmlFn)> {
"slivar" => None,
- "exomiser" => None,
+ "exomiser" => Some((sections::exomiser::text, sections::exomiser::html)),
"structural-variants" => None,
- "mei" => None,
+ "mei" => Some((sections::mei::text, sections::mei::html)),
"expansions" => None,
- "vntyper" => None,
+ "vntyper" => Some((sections::vntyper::text, sections::vntyper::html)),
"mito" => None,
"lpa" => None,
- "chip" => None,
+ "chip" => Some((sections::chip::text, sections::chip::html)),
"mosaic" => None,
- "mosaic-mca" => None,
+ "mosaic-mca" => Some((sections::mocha::text, sections::mocha::html)),
"carrier-list" => None,
@@ -205,7 +205,7 @@ pub fn writer(sid: &str) -> Option<(TextFn, HtmlFn)> {
"hla" => None,
- "locityper" => None,
+ "locityper" => Some((sections::locityper::text, sections::locityper::html)),
"ancestry-fine" => None,
@@ -217,7 +217,7 @@ pub fn writer(sid: &str) -> Option<(TextFn, HtmlFn)> {
"ancient" => None,
- "roh" => None,
+ "roh" => Some((sections::roh::text, sections::roh::html)),
"traits-panel" => None,
@@ -225,9 +225,9 @@ pub fn writer(sid: &str) -> Option<(TextFn, HtmlFn)> {
"bloodtype" => None,
- "telomere" => None,
+ "telomere" => Some((sections::telomere::text, sections::telomere::html)),
- "viral" => None,
+ "viral" => Some((sections::viral::text, sections::viral::html)),
"consumer-export" => None,
diff --git a/rust/crates/og-render/src/html.rs b/rust/crates/og-render/src/html.rs
index 43e75f02b..73014859f 100644
--- a/rust/crates/og-render/src/html.rs
+++ b/rust/crates/og-render/src/html.rs
@@ -9,8 +9,10 @@
use crate::chapters::{CHAPTERS, FrameState, LIMITS, Sec, step_of, writer};
use crate::css::CSS;
use crate::escape::e;
-use crate::model::{Card, Colour, HtmlPart, Inline, Line, Malformed, Section, State, Summary, py};
-use crate::notes::stale_note;
+use crate::model::{
+ Card, Cell, Colour, HtmlPart, Inline, Line, Malformed, Section, State, Summary, Table, py,
+};
+use crate::notes::{VIEWER_NOTE, stale_note};
use crate::sections::run;
/// The Content-Security-Policy: nothing is fetched, images only inline,
@@ -48,6 +50,7 @@ pub fn offsite_link(url: &str, text: &str, why: &str) -> String {
fn inline(v: &Inline) -> String {
match v {
Inline::Text(t) => e(t).into_owned(),
+ Inline::Fixed(t) => (*t).to_owned(),
Inline::Badge(t, c) => badge(t, *c),
Inline::Quiet(t) => format!(
"{}",
@@ -63,6 +66,7 @@ fn line(out: &mut Vec {} {}{} ", e(t)),
+ Cell::Badge(t, colour) => format!("{} ", badge(t, *colour)),
+ Cell::Sub(t, sub) => format!(
+ "{} ",
+ e(t),
+ e(sub)
+ ),
+ Cell::Viewer(None) => "
{}".to_owned(),
+ Cell::Viewer(Some(at)) => format!(
+ " {0} ",
+ e(at)
+ ),
+ }
+}
+
+fn table(out: &mut Vec{} ", e(h)))
+ .collect();
+ if t.viewer {
+ head.push_str("Viewer ");
+ }
+ let rows = t
+ .rows
+ .iter()
+ .map(|r| format!("{} ", r.iter().map(cell).collect::
",
+ rows.collect::{head} {}".to_owned());
+ out.push(format!("
".to_owned());
+ }
+ if t.viewer {
+ out.push(VIEWER_NOTE.to_owned());
+ }
+}
+
/// The card of one summary section: a section that did not run shows
/// "Not run", a failed one "Failed" and an unreadable one "Unreadable",
/// in place of its lines; a stale, failed or unreadable one says so in a box.
diff --git a/rust/crates/og-render/src/model.rs b/rust/crates/og-render/src/model.rs
index 54ea06364..761afdb8b 100644
--- a/rust/crates/og-render/src/model.rs
+++ b/rust/crates/og-render/src/model.rs
@@ -312,6 +312,53 @@ pub enum Inline {
Badge(String, Colour),
/// Text in normal weight and a smaller size, for a reason or a remark.
Quiet(String),
+ /// A fixed text written as it is, unescaped, as render_report.py's
+ /// stat() writes its value (an apostrophe stays an apostrophe).
+ Fixed(&'static str),
+}
+
+/// One cell of a table row.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum Cell {
+ /// Plain text.
+ Text(String),
+ /// A coloured badge.
+ Badge(String, Colour),
+ /// Text with a second, smaller grey line under it.
+ Sub(String, String),
+ /// The Viewer cell: a link that opens the locus (`chrom:start` or
+ /// `chrom:start-end`) in the genome viewer; empty without a locus.
+ Viewer(Option{head} "));
+ out.extend(rows.map(|r| format!(" {r}")));
+ out.push("