web/dreamstop.openfp.net · commit
Serve the manual as a PDF only
parents: 5e907071f8
Serve the manual as a PDF only The site no longer builds the HTML manual. The manual is served at /manual/dreamstop.pdf, and the front page's links open it. The manual-says check now reads the PDF's text.
5 files changed
Diff
BUILD.md | 6 +++--- dreamstop-openfp-net-web/ChangeLog.md | 4 ++++ dreamstop-openfp-net-web/README.md | 2 +- dreamstop-openfp-net-web/src/Site/Content.hs | 4 ++-- nix/site.nix | 26 ++++++++++++-------------- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/BUILD.md b/BUILD.md index 49de2c5..6086859 100644 @@ -13,8 +13,8 @@ nix build builds the served directory into `result/`: `index.html`, the client bundle `site.js` and its `.gz`, the kit's static files and fonts under -`design-kit/`, `dreamstop.css`, `dreamstop.svg`, `og.png`, and the user -manual under `manual/` as `index.html` and `dreamstop.pdf`. Nothing built +`design-kit/`, `dreamstop.css`, `codepoints.css`, `dreamstop.svg`, `og.png`, and +the user manual as `manual/dreamstop.pdf`. Nothing built is committed. ```sh @@ -23,7 +23,7 @@ nix build .#manual builds only the manual. Its source is `manual/dreamstop.vx`, in Inkwell. The build renders it to Typst with `inkwell-render` from the pinned -inkwell-dsl input and compiles the Typst to PDF and HTML. +inkwell-dsl input and compiles the Typst to PDF. ```sh nix run .#serve diff --git a/dreamstop-openfp-net-web/ChangeLog.md b/dreamstop-openfp-net-web/ChangeLog.md index 2137ec2..b28480b 100644 @@ -1,5 +1,9 @@ # ChangeLog +## Unreleased + +- The manual is now a PDF only, at `/manual/dreamstop.pdf`, and every link on the front page opens it. + ## 0.2.1.0 — 2026-12-06 - The text on the front page now fills the central column, as wide as the example boxes. diff --git a/dreamstop-openfp-net-web/README.md b/dreamstop-openfp-net-web/README.md index 33c68c1..ffb3f89 100644 @@ -4,7 +4,7 @@ The dreamstop.openfp.net website: the front page of dreamstop, a language for continuous disambiguation. The page says what dreamstop is, shows the three verdicts a sentence can get (clear, ambiguous and nonsense) with an example of each, and teaches minimal pairs with one pair from a real -ChangeLog. It links the dreamstop user manual, served at `/manual/`. +ChangeLog. It links the dreamstop user manual, a PDF served at `/manual/dreamstop.pdf`. ## What it gives you diff --git a/dreamstop-openfp-net-web/src/Site/Content.hs b/dreamstop-openfp-net-web/src/Site/Content.hs index 0a783e2..1a7058f 100644 @@ -30,11 +30,11 @@ repository = "https://nixlab.openfp.net/web/dreamstop.openfp.net" package :: MisoString package = "https://nixlab.openfp.net/dreamstop/dreamstop" +-- | The user manual, a PDF published with the page. -- -- @since 0.1.0.0 manual :: MisoString -manual = "manual/" +manual = "manual/dreamstop.pdf" -- | One reading of a sentence: its codes and a plain gloss. -- -- @since 0.2.0.0 diff --git a/nix/site.nix b/nix/site.nix index c1b4228..6bc8d18 100644 @@ -114,7 +114,7 @@ local: }; layerNames = builtins.attrNames codepoints.layers; # Each layer's colour as a class, and each code's class in its layer's - # colour, for the front page and the manual. + # colour, for the front page. codepointsCss = pkgs.writeText "codepoints.css" ( lib.concatMapStrings ( l: @@ -123,19 +123,17 @@ local: ) layerNames + ".cp-mark { color: ${codepoints.mark}; }\n" ); - # Show rules that colour every code in the manual: a class in HTML, - # the same colour in the PDF. + # Show rules that colour every code in the manual PDF. codepointsTypst = pkgs.writeText "codepoints.typ" ( '' - #let cp(cls, col) = it => context if target() == "html" { html.elem("span", attrs: (class: cls), it) } else { text(fill: rgb(col), it) } - #context if target() == "html" { html.elem("link", attrs: (rel: "stylesheet", href: "codepoints.css")) } - #show regex("[\\[\\]·]|/(rel|adv|comp)[0-9]+"): cp("cp-mark", "${codepoints.mark}") + #let cp(col) = it => text(fill: rgb(col), it) + #show regex("[\\[\\]·]|/(rel|adv|comp)[0-9]+"): cp("${codepoints.mark}") '' + lib.concatMapStrings ( l: "#show regex(\"\\\\b(${ lib.concatStringsSep "|" codepoints.layers.${l}.codes - })\\\\b\"): cp(\"cp-${l}\", \"${codepoints.layers.${l}.colour}\")\n" + })\\\\b\"): cp(\"${codepoints.layers.${l}.colour}\")\n" ) layerNames ); manualFonts = "${pkgs.dejavu_fonts}/share/fonts"; @@ -153,22 +151,22 @@ local: ${lib.getExe' inkwellSet.inkwell-dsl "inkwell-render"} ${../manual/dreamstop.vx} \ "$("$NIX_GHC" --print-global-package-db)" > body.typ cat ${codepointsTypst} body.typ > dreamstop.typ - cp ${codepointsCss} $out/manual/codepoints.css - typst compile --features html --font-path ${manualFonts} dreamstop.typ $out/manual/dreamstop.pdf - typst compile --features html --format html --font-path ${manualFonts} \ - dreamstop.typ $out/manual/index.html + typst compile --font-path ${manualFonts} dreamstop.typ $out/manual/dreamstop.pdf ''; - # The manual names neither Ithkuil nor Quijada. + # The manual PDF holds the manual and names neither Ithkuil nor Quijada. manualSays = pkgs.runCommand "dreamstop.openfp.net-manual-says" { + nativeBuildInputs = [ pkgs.poppler-utils ]; LANG = "C.UTF-8"; LC_ALL = "C.UTF-8"; } '' + pdftotext ${manual}/manual/dreamstop.pdf manual.txt + grep -qF "Reference table" manual.txt || { echo "manual: the PDF holds no reference table" >&2; exit 1; } for t in Ithkuil Quijada; do - if grep -qiF "$t" ${manual}/manual/index.html; then echo "manual: it names $t" >&2; exit 1; fi + if grep -qiF "$t" manual.txt; then echo "manual: it names $t" >&2; exit 1; fi done touch $out ''; @@ -200,7 +198,7 @@ local: flakeLock = ../flake.lock; horizonVx = ../horizon.vx; expect = [ - ''<a class="btn" id="manual" href="manual/">Read the manual</a>'' + ''<a class="btn" id="manual" href="manual/dreamstop.pdf">Read the manual</a>'' { absent = "Ithkuil"; } { absent = "Continuous Disambiguation"; } ''<a href="${forge}/web/dreamstop.openfp.net">Page source</a>''