web/dreamstop.openfp.net · commit
Drop the Nix prose readers and build only where horizon-javascript has a GHC
parents: b1e532a6f6
Drop the Nix prose readers and build only where horizon-javascript has a GHC nix/site.nix took the annotation files apart with regexes and restated the manual and website kinds, which VX.ReadVortexThroughElaboration forbids. The prose check, the sentence lists given to manual-says and the reading-without-JavaScript check, and the Nix copy of the kinds are gone. The annotations stay as data for a dreamstop checker that elaborates them. The flake now declares the systems horizon-javascript offers a GHC for, in place of dropping every output elsewhere.
6 files changed
Diff
BUILD.md | 15 +- dreamstop-openfp-net-web/ChangeLog.md | 9 +- nix/configuration.nix | 1 - nix/site.nix | 516 ++-------------------------------- prose/front.vx | 4 +- prose/questions.vx | 4 +- 6 files changed, 38 insertions(+), 511 deletions(-) diff --git a/BUILD.md b/BUILD.md index 4f7839a..49de2c5 100644 @@ -39,19 +39,8 @@ runs the kit's checks on the page (render, CSP, links, reading without JavaScript, hydrate, bundle, card, pins and generated files), with the page's own expected links, text and preview tags. It also runs these: -- `prose` checks that every sentence of the manual and of - `prose/front.vx` carries a dreamstop reading in display order, that - each clause keeps the laws one clause can break, and that each clause - matches a pattern for its position: the manual kind for the manual and - the website kind for the front page. Every noun for an act, such - as review or build, after a determiner must carry BSC or OBJ in braces. - It checks that no manual paragraph - is unannotated, that every procedure has a section for each Manual - question and that neither file has a semicolon. -- `manual-says` checks that the manual's HTML says every annotated - sentence, and that it does not mention Ithkuil or Quijada. -- The kit's reading-without-JavaScript check is given every sentence of - `prose/front.vx`, so the page must say each one. +- `manual-says` checks that the manual does not mention Ithkuil or + Quijada. - `card-copy` checks that the card says the tagline and shows `dreamstop.svg`. The package must build under werrorwolf, and the Nix must be formatted. diff --git a/dreamstop-openfp-net-web/ChangeLog.md b/dreamstop-openfp-net-web/ChangeLog.md index c7fab80..016f4c8 100644 @@ -25,10 +25,5 @@ `manual/dreamstop.vx`, written in Inkwell. - Added a dreamstop reading to every sentence of the page and the manual, kept as data beside each manual sentence and in `prose/front.vx` for the - page, and a build check that refuses a reading that is not in display - order under the rules for manuals or that breaks a clause law, a step - with no stated result, a recovery that does not start from a failed - precondition, a manual paragraph without readings and a sentence the - rendered page or manual does not say. `prose/questions.vx` maps each - procedure to the sections that answer the four questions of a manual, - and the build refuses a section the manual lacks. + page. `prose/questions.vx` maps each procedure to the sections that + answer the four questions of a manual. diff --git a/nix/configuration.nix b/nix/configuration.nix index a0d3b4e..d274b3f 100644 @@ -1,4 +1,3 @@ _: { - horizon.systems.supported.enable = true; horizon.formatting.enable = true; } diff --git a/nix/site.nix b/nix/site.nix index bcad680..7200ce0 100644 @@ -1,6 +1,11 @@ local: { + # The systems horizon-javascript offers a GHC for. + systems = builtins.filter (s: local.inputs.horizon-javascript.legacyPackages.${s} ? ghc) ( + builtins.attrNames local.inputs.horizon-javascript.legacyPackages + ); + perSystem = { config, @@ -14,8 +19,7 @@ local: hl = pkgs.haskell.lib.compose; kit = import "${design-kit}/site.nix" { inherit pkgs; }; - jsSet = local.inputs.horizon-javascript.legacyPackages.${system} or { }; - jsOffered = jsSet ? ghc; + jsSet = local.inputs.horizon-javascript.legacyPackages.${system}; siteSet = config.legacyPackages; inkwellSet = local.inputs.inkwell-dsl.legacyPackages.${system}; @@ -27,394 +31,6 @@ local: }; manualFonts = "${pkgs.dejavu_fonts}/share/fonts"; - # Every sentence of the front page and the manual, with its dreamstop - # annotation. The manual keeps each sentence beside its annotation in - # `s "ANNOTATION" "SENTENCE"` and `sx "ANNOTATION" [...]`. The front - # page's are in prose/front.vx as `sentence "ANNOTATION" "SENTENCE"`. - captures = - pattern: file: lib.filter builtins.isList (builtins.split pattern (builtins.readFile file)); - manualSentences = map (m: { - annotation = lib.elemAt m 0; - sentence = lib.elemAt m 1; - }) (captures ''s "(\[[^"]*)" "([^"]*)"'' ../manual/dreamstop.vx); - manualMixed = map (m: lib.elemAt m 0) (captures ''sx "(\[[^"]*)" \['' ../manual/dreamstop.vx); - questionSections = map (m: lib.elemAt m 0) ( - captures ''answers "[^"]*" "([^"]*)"'' ../prose/questions.vx - ); - manualSections = map (m: lib.elemAt m 0) (captures ''Identifier "([^"]*)"'' ../manual/dreamstop.vx); - unanswered = lib.filter (q: !(lib.elem q manualSections)) questionSections; - frontSentences = map (m: { - annotation = lib.elemAt m 0; - sentence = lib.elemAt m 1; - }) (captures ''sentence "(\[[^"]*)" "([^"]*)"'' ../prose/front.vx); - - manualSteps = map (m: { - step = lib.elemAt m 0; - stepSentence = lib.elemAt m 1; - result = lib.elemAt m 2; - resultSentence = lib.elemAt m 3; - }) (captures ''stepThen "(\[[^"]*)" "([^"]*)" "(\[[^"]*)" "([^"]*)"'' ../manual/dreamstop.vx); - manualRecoveries = map (m: { - annotation = lib.elemAt m 0; - sentence = lib.elemAt m 1; - }) (captures ''recover "(\[[^"]*)" "([^"]*)"'' ../manual/dreamstop.vx); - - # A reading (specification 2.3): clauses in display order, Force · Mood - # · Aspect · Phase · NEG · Ground · Strength · NEG · Bound · Evidence, - # each subordinate clause followed by its position and the number of - # its parent clause, as in [ASR·HAB]/rel1. - codes = "(ASR|DIR|IRG|DEC|ADM|CMS)(·(HYP|COU))?·(PFV|PRF|PRG|HAB)(·(INC|CSS|CNT|EXP))?(·NEG)?(·(DEO|ABL|TEL)·(NEC|WNC|POS)(·NEG)?)?(·ONE)?(·(OBS|PUP|RPR|INF|REC))?"; - nouns = "\\{[a-z-]+: (BSC|OBJ)(, [a-z-]+: (BSC|OBJ))*}"; - clause = "\\[${codes}](/(rel|adv|comp)[0-9]+)?( ${nouns})?"; - slotsOf = - text: - let - g = builtins.match codes text; - at = lib.elemAt g; - in - { - force = at 0; - mood = at 2; - aspect = at 3; - phase = at 5; - modal = - if at 8 == null then - null - else - lib.concatStrings [ - (toString (at 6)) - (at 8) - (at 9) - (toString (at 10)) - ]; - outerNeg = at 6 != null; - innerNeg = at 10 != null; - ground = at 8; - strength = at 9; - bound = at 11; - evidence = at 13; - }; - clausesOf = - a: - map (m: { - slots = slotsOf (lib.elemAt m 0); - position = - if lib.elemAt m 2 == null then - "main" - else - { - rel = "relative"; - adv = "adverbial"; - comp = "complement"; - } - .${lib.elemAt m 2}; - parent = if lib.elemAt m 3 == null then null else lib.toInt (lib.elemAt m 3) - 1; - }) (lib.filter builtins.isList (builtins.split "\\[([^]]*)](/(rel|adv|comp)([0-9]+))?" a)); - - # The laws of specification 3.3 that one clause can break. - clauseLaws = [ - { - law = "ONE excludes HAB (law 9)"; - holds = x: !(x.bound != null && x.aspect == "HAB"); - } - { - law = "evidence on ASR·FAC only (law 10)"; - holds = x: x.evidence == null || (x.force == "ASR" && x.mood == null); - } - { - law = "HYP only on ASR and IRG, COU only on ASR (law 11)"; - holds = x: x.mood == null || x.force == "ASR" || (x.mood == "HYP" && x.force == "IRG"); - } - { - law = "no phase on DEC or CMS (law 8)"; - holds = - x: - x.phase == null - || !(lib.elem x.force [ - "DEC" - "CMS" - ]); - } - { - law = "NEG·G·NEC·NEG and NEG·G·POS·NEG are written G·POS and G·NEC (rewrite 1)"; - holds = x: !(x.outerNeg && x.innerNeg && x.strength != "WNC"); - } - ]; - - # Document kinds (specification 5.2): a pattern maps each slot it - # mentions to a list of codes, "required" or "optional". An unmentioned - # slot is empty. A subordinate pattern names its parent main pattern. - slotNames = [ - "force" - "mood" - "aspect" - "phase" - "modal" - "bound" - "evidence" - ]; - matches = - pattern: x: - lib.all ( - n: - let - spec = pattern.${n} or null; - v = x.${n}; - in - if spec == null then - v == null - else if spec == "required" then - v != null - else if spec == "optional" then - true - else - lib.elem v spec - ) slotNames; - allowedBy = - kind: cs: x: - if x.position == "main" then - lib.any (p: matches p x.slots) (lib.attrValues kind.main) - else - x.parent != null - && x.parent < lib.length cs - && (lib.elemAt cs x.parent).position == "main" - && lib.any ( - s: - s.position == x.position - && matches s.pattern x.slots - && matches kind.main.${s.parent} (lib.elemAt cs x.parent).slots - ) kind.subordinate; - manualKind = - let - plain = { - force = [ "ASR" ]; - aspect = "required"; - modal = "optional"; - }; - in - { - main = { - step = { - force = [ "DIR" ]; - aspect = [ - "PFV" - "PRG" - "HAB" - ]; - modal = "optional"; - }; - statement = { - force = [ "ASR" ]; - aspect = [ - "PFV" - "HAB" - ]; - modal = "optional"; - evidence = "optional"; - }; - warning = { - force = [ "ADM" ]; - aspect = [ - "PFV" - "PRG" - "HAB" - ]; - modal = "optional"; - }; - }; - subordinate = [ - { - position = "adverbial"; - parent = "step"; - pattern = { - force = [ "ASR" ]; - aspect = [ - "PRF" - "HAB" - ]; - modal = "optional"; - }; - } - { - position = "adverbial"; - parent = "step"; - pattern = { - force = [ "IRG" ]; - aspect = [ "HAB" ]; - modal = "optional"; - }; - } - ] - ++ - lib.concatMap - (parent: [ - { - position = "relative"; - inherit parent; - pattern = plain; - } - { - position = "complement"; - inherit parent; - pattern = plain; - } - ]) - [ - "step" - "statement" - "warning" - ] - ++ - map - (parent: { - position = "adverbial"; - inherit parent; - pattern = plain; - }) - [ - "statement" - "warning" - ]; - }; - websiteKind = - let - description = { - force = [ "ASR" ]; - aspect = [ "HAB" ]; - modal = "optional"; - evidence = "optional"; - }; - in - { - main = { - claim = description; - plan = { - force = [ "CMS" ]; - aspect = [ "PFV" ]; - }; - invitation = { - force = [ "DIR" ]; - aspect = [ "PFV" ]; - }; - }; - subordinate = - lib.concatMap - (parent: [ - { - position = "relative"; - inherit parent; - pattern = description; - } - { - position = "complement"; - inherit parent; - pattern = description; - } - { - position = "adverbial"; - inherit parent; - pattern = { - force = [ "ASR" ]; - aspect = [ - "PRF" - "HAB" - ]; - modal = "optional"; - }; - } - ]) - [ - "claim" - "plan" - "invitation" - ]; - }; - - manualReadings = - map (x: x.annotation) (manualSentences ++ manualRecoveries) - ++ manualMixed - ++ lib.concatMap (x: [ - x.step - x.result - ]) manualSteps; - readings = - map (a: { - kind = manualKind; - name = "manual"; - inherit a; - }) manualReadings - ++ map (x: { - kind = websiteKind; - name = "website"; - a = x.annotation; - }) frontSentences; - # Specification 2.12: an act noun after a determiner carries BSC or OBJ - # in its sentence's reading. Quoted examples are content and are skipped. - actNouns = "review|release|import|migration|rewrite|edit|test|check|segmentation|disambiguation|verification|annotation|backup|build|change|move|upgrade|configuration|installation"; - unquoted = text: lib.concatStrings (lib.filter builtins.isString (builtins.split "“[^”]*”" text)); - nounsWith = - middle: text: - map (m: lib.elemAt m 3) ( - lib.filter - ( - m: - builtins.isList m - && !( - lib.elemAt m 4 == "s" - && lib.elem (lib.elemAt m 7) [ - "every" - "a" - "an" - "each" - "no" - "the" - "its" - "it" - "any" - ] - ) - ) - ( - builtins.split "(^|[^a-z])(the|a|an|each|every|this|its|one|no|any|three|both)(${middle}) (${actNouns})(s?)(([^a-z])([a-z]+)?|$)" ( - lib.toLower (unquoted text) - ) - ) - ); - nounsIn = text: lib.unique (nounsWith "" text ++ nounsWith " [a-z-]+" text); - coded = - a: map (m: lib.elemAt m 0) (lib.filter builtins.isList (builtins.split "([a-z-]+): (BSC|OBJ)" a)); - sentencePairs = - manualSentences - ++ manualRecoveries - ++ frontSentences - ++ lib.concatMap (x: [ - { - annotation = x.step; - sentence = x.stepSentence; - } - { - annotation = x.result; - sentence = x.resultSentence; - } - ]) manualSteps; - uncoded = lib.concatMap ( - x: - map (n: "${x.sentence}: the act noun ${n} carries no BSC or OBJ") ( - lib.filter (n: !(lib.elem n (coded x.annotation))) (nounsIn x.sentence) - ) - ) sentencePairs; - illFormed = lib.filter (r: builtins.match "${clause}( ${clause})*" r.a == null) readings; - broken = lib.concatMap ( - r: - let - cs = clausesOf r.a; - in - lib.concatMap (x: map (l: "${r.a}: ${l.law}") (lib.filter (l: !(l.holds x.slots)) clauseLaws)) cs - ++ map (_x: "${r.a}: a clause matches no ${r.name} pattern for its position") ( - lib.filter (x: !(allowedBy r.kind cs x)) cs - ) - ) readings; - manual = pkgs.runCommand "dreamstop.openfp.net-manual" { @@ -432,8 +48,7 @@ local: dreamstop.typ $out/manual/index.html ''; - # The manual's HTML says every annotated sentence, with typographic - # quotes and apostrophes folded to ASCII and whitespace collapsed. + # The manual names neither Ithkuil nor Quijada. manualSays = pkgs.runCommand "dreamstop.openfp.net-manual-says" { @@ -441,71 +56,12 @@ local: LC_ALL = "C.UTF-8"; } '' - sed -e 's/'/'"'"'/g; s/"/"/g; s/&/\&/g; s/’/'"'"'/g; s/‘/'"'"'/g' \ - ${manual}/manual/index.html | tr -s ' \n' ' ' > manual.txt - while IFS= read -r t; do - grep -qF -- "$t" manual.txt || { echo "manual: the HTML does not say: $t" >&2; exit 1; } - done < ${ - pkgs.writeText "manual-sentences" ( - lib.concatMapStrings (x: x + "\n") ( - map (x: x.sentence) (manualSentences ++ manualRecoveries) - ++ lib.concatMap (x: [ - x.stepSentence - x.resultSentence - ]) manualSteps - ) - ) - } for t in Ithkuil Quijada; do - if grep -qiF "$t" manual.txt; then echo "manual: it names $t" >&2; exit 1; fi + if grep -qiF "$t" ${manual}/manual/index.html; then echo "manual: it names $t" >&2; exit 1; fi done touch $out ''; - # Every sentence carries a well-formed reading that keeps the clause laws - # and the patterns of its kind: the manual kind for the manual, the - # website kind for the front page. Every manual paragraph is annotated, - # no prose has a semicolon, and every procedure has a section for each - # Manual question. - # Whether an annotation is the right reading is for review. - prose = - pkgs.runCommand "dreamstop.openfp.net-prose" - { - LANG = "C.UTF-8"; - LC_ALL = "C.UTF-8"; - } - '' - ${lib.concatMapStrings (r: '' - echo "prose: not a reading in display order: ${lib.escapeShellArg r.a}" >&2 - '') illFormed} - ${lib.optionalString (illFormed != [ ]) "exit 1"} - ${lib.concatMapStrings (m: '' - echo "prose: ${lib.escapeShellArg m}" >&2 - '') (broken ++ uncoded)} - ${lib.optionalString (broken ++ uncoded != [ ]) "exit 1"} - ${lib.concatMapStrings (q: '' - echo "prose: prose/questions.vx names a section the manual lacks: ${lib.escapeShellArg q}" >&2 - '') unanswered} - ${lib.optionalString (unanswered != [ ] || lib.length questionSections != 12) "exit 1"} - if grep -nE 'paragraph \[|paragraph \(t ' ${../manual/dreamstop.vx} | grep -v 'quotation'; then - echo "prose: a manual paragraph above is not annotated" >&2; exit 1 - fi - # Pair rows are copied from the kind repositories and keep their text. - if grep -Hn ';' ${../manual/dreamstop.vx} ${../prose/front.vx} | grep -v ':[0-9]*: *[[,] pair "'; then - echo "prose: no semicolons" >&2; exit 1 - fi - echo "prose: ${ - toString ( - lib.length manualSentences - + lib.length manualMixed - + lib.length manualRecoveries - + 2 * lib.length manualSteps - ) - } manual and ${toString (lib.length frontSentences)} front-page sentences, ${ - toString (lib.foldl' (n: r: n + lib.length (clausesOf r.a)) 0 readings) - } clauses" > $out - ''; - name = "dreamstop"; title = "dreamstop — a language for continuous disambiguation"; description = "dreamstop is a language for continuous disambiguation. Readers annotate each sentence, and authors rewrite any sentence that is not clear."; @@ -551,7 +107,7 @@ local: (meta "property" "og:image:type" "image/png") (meta "name" "twitter:card" "summary_large_image") ]; - nojsText = map (x: x.sentence) frontSentences ++ [ "Read the manual" ]; + nojsText = [ "Read the manual" ]; }; cardCopy = pkgs.runCommand "dreamstop.openfp.net-card-copy" { } '' @@ -561,39 +117,27 @@ local: touch $out ''; in - lib.mkMerge [ - { - horizon.overlay = - if jsOffered then - { - basePackages = jsSet; - overlays = [ - (_final: prev: lib.mapAttrs (name: _: hl.dontHaddock prev.${name}) config.horizon.pkgs) - ]; - } - else - lib.mkForce null; - } - (lib.mkIf (!jsOffered) { - horizon.werrorwolf.enable = lib.mkForce false; - horizon.devShell.enable = lib.mkForce false; - }) - (lib.mkIf jsOffered { - packages = { - default = site.package; - inherit manual; - }; + { + horizon.overlay = { + basePackages = jsSet; + overlays = [ + (_final: prev: lib.mapAttrs (name: _: hl.dontHaddock prev.${name}) config.horizon.pkgs) + ]; + }; - apps.serve = { - type = "app"; - program = toString site.serve; - }; + packages = { + default = site.package; + inherit manual; + }; - checks = site.checks // { - card-copy = cardCopy; - manual-says = manualSays; - inherit prose; - }; - }) - ]; + apps.serve = { + type = "app"; + program = toString site.serve; + }; + + checks = site.checks // { + card-copy = cardCopy; + manual-says = manualSays; + }; + }; } diff --git a/prose/front.vx b/prose/front.vx index 3d76181..9976148 100644 @@ -2,8 +2,8 @@ -- reading under the website kind: one clause per finite verb group, codes in -- display order, and each subordinate clause's position and parent after a -- slash. Headings, navigation, button labels and the sentences shown as +-- examples are not prose and are not listed. No check reads +-- this file yet: review judges each reading. do sentence "[ASR·HAB] {disambiguation: BSC}" "dreamstop is a language for continuous disambiguation." sentence "[ASR·HAB]" "It secures one property." diff --git a/prose/questions.vx b/prose/questions.vx index ef7bb7f..c4cd57f 100644 @@ -1,6 +1,6 @@ -- The Manual question set for each procedure in the manual: the section a +-- reader answers each question from. No check reads this +-- file yet: review judges each answer. do procedure "Annotating a sentence" (answers "What do I do?" "Annotating a sentence")