web/dreamstop.openfp.net · commit
Colour codepoints and quote the handbook's examples
parents: fdc38e86f3
Colour codepoints and quote the handbook's examples The front page takes the owner's new introduction, shows the handbook's clear, ambiguous and nonsense examples, its modality contrast and its review-store pair, and lists an ambiguous sentence's readings with a gloss for each. Codepoints are coloured by layer on the front page and in the manual from one layer table in nix/site.nix, with a legend on the front page. A minimal pair is now two sentences that differ by the smallest possible edit that makes the sentence clear. The example boxes share the text column's width.
8 files changed
Diff
dreamstop-openfp-net-web/ChangeLog.md | 7 +- dreamstop-openfp-net-web/src/Site/Content.hs | 96 +++++++++++++--------- dreamstop-openfp-net-web/src/Site/Page.hs | 4 +- dreamstop-openfp-net-web/src/Site/View.hs | 104 +++++++++++++++++------- dreamstop.css | 11 ++- manual/dreamstop.vx | 19 +++-- nix/site.nix | 117 ++++++++++++++++++++++++++- prose/front.vx | 23 +++--- 8 files changed, 283 insertions(+), 98 deletions(-) diff --git a/dreamstop-openfp-net-web/ChangeLog.md b/dreamstop-openfp-net-web/ChangeLog.md index f8b1004..f1e2ade 100644 @@ -2,8 +2,13 @@ ## Unreleased -- The front page now explains in plain words what dreamstop checks, and says that each sentence is marked by annotators, which are programs. +- The front page now explains in plain words what dreamstop checks, and says that a program marks up every clause with codepoints. +- The front page and the manual now colour each codepoint by its layer, such as force, aspect or modality, and the front page shows a legend of the colours. +- The front page now shows examples quoted from the OpenFP Quality Control Handbook, including a contrast between required, allowed and able. +- The front page and the manual's Verdicts chapter now list the readings of an ambiguous sentence as a numbered list, each with a plain gloss. +- The front page and the manual now define a minimal pair as two sentences that differ by the smallest possible edit that makes the sentence clear. - The manual now calls the program that marks each clause an annotator instead of a reader, and uses "reader" only for a person reading a document. +- The example boxes on the front page are now as wide as the text around them. ## 0.1.0.0 — 2026-12-06 diff --git a/dreamstop-openfp-net-web/src/Site/Content.hs b/dreamstop-openfp-net-web/src/Site/Content.hs index 2dc3bb1..0a783e2 100644 @@ -1,14 +1,16 @@ +-- | What the page says that is data: its links, the three verdicts, the +-- modality contrast and the minimal pair, each example quoted verbatim from +-- the OpenFP Quality Control Handbook 0.18.0.0. -- -- @since 0.1.0.0 module Site.Content ( repository , package , manual - , Verdict (MkVerdict, verdictName, verdictSentence, verdictAnnotations, verdictText) + , Reading (MkReading, readingCodes, readingGloss) + , Example (MkExample, exampleLabel, exampleSentence, exampleReadings) , verdicts - , Side (MkSide, sideLabel, sideSentence, sideAnnotation) + , modalities , pair , pairSlot ) where @@ -33,64 +35,78 @@ package = "https://nixlab.openfp.net/dreamstop/dreamstop" -- @since 0.1.0.0 manual :: MisoString manual = "manual/" +-- | One reading of a sentence: its codes and a plain gloss. +-- +-- @since 0.2.0.0 +type Reading :: Type +data Reading = MkReading + { readingCodes :: MisoString + , readingGloss :: MisoString + } +-- | An example sentence under a label, with every reading annotators find. +-- No reading means the sentence is nonsense. -- -type Verdict :: Type -data Verdict = MkVerdict - { verdictName :: MisoString - , verdictSentence :: MisoString - , verdictAnnotations :: [MisoString] - , verdictText :: MisoString +-- @since 0.2.0.0 +type Example :: Type +data Example = MkExample + { exampleLabel :: MisoString + , exampleSentence :: MisoString + , exampleReadings :: [Reading] } +-- | Clear, ambiguous and nonsense, each with an example from the handbook's +-- ChangeLog chapter (CLG.MarkChangeAspect and +-- CLG.DescribeAddedThingsInPresent). -- -- @since 0.1.0.0 -verdicts :: [Verdict] +verdicts :: [Example] verdicts = - [ MkVerdict + [ MkExample "Clear" "The shell no longer accepts unsigned commands." - ["[ASR·HAB·CSS]"] - "The sentence has one reading, the same for every reader." - , MkVerdict + [MkReading "[ASR·HAB·CSS]" "the shell accepted unsigned commands before this release and does not accept them from this release on"] + , MkExample "Ambiguous" - "Added the review store, which moved reviews out of SQLite." - ["[ASR·PFV] [ASR·PFV·ONE]", "[ASR·PFV] [ASR·HAB]"] - "Readers find different readings, so the author picks one and rewrites the sentence." - , MkVerdict + "Added the review store, which moved reviews and sign-offs out of SQLite." + [storeMoves, storeMoved] + , MkExample "Nonsense" - "The shell now still accepts unsigned commands." + "Removed the legacy importer, which reads the old export format." [] - "The sentence has no coherent reading, because now and still claim opposite histories." ] +-- | Required, allowed and able: the handbook's modality examples +-- (section 1.4.5), whose codes differ only in the modal. -- -type Side :: Type -data Side = MkSide - { sideLabel :: MisoString - , sideSentence :: MisoString - , sideAnnotation :: MisoString - } +-- @since 0.2.0.0 +modalities :: [Example] +modalities = + [ MkExample "Required" "You must regenerate the file" [MkReading "[ASR·HAB·DEO·NEC]" "a rule requires it"] + , MkExample "Allowed" "You may edit the file" [MkReading "[ASR·HAB·DEO·POS]" "a rule allows it"] + , MkExample "Able" "The host can read a file" [MkReading "[ASR·HAB·ABL·POS]" "the host is able to"] + ] +-- | The handbook's contrast for CLG.DescribeAddedThingsInPresent as a +-- minimal pair. -- -- @since 0.1.0.0 -pair :: [Side] +pair :: [Example] pair = - [ MkSide "Bad" "Added the review store, which moves reviews out of SQLite." "[ASR·PFV] {review: OBJ} [ASR·HAB]/rel1 {reviews: OBJ} or [ASR·PFV] {review: OBJ} [ASR·PFV·INC·ONE]/rel1 {reviews: OBJ}" - , MkSide "Good" "Added the review store, which keeps reviews in acid-state." "[ASR·PFV] {review: OBJ} [ASR·HAB]/rel1 {reviews: OBJ}" + [ MkExample "Bad" "Added the review store, which moved reviews and sign-offs out of SQLite." [storeMoves, storeMoved] + , MkExample "Good" "Added the review store, which moves reviews and sign-offs out of SQLite." [storeMoves] ] -- | The pair's question and its edit. -- -- @since 0.1.0.0 pairSlot :: MisoString -pairSlot = "Question: what behaves differently now? Edit: moves becomes keeps, which leaves clause 2 only its HAB reading" +pairSlot = "Question: what does the store do? Edit: moved becomes moves, which leaves clause 2 only its HAB reading" + +-- | The review-store relative clause read as what the store does. +storeMoves :: Reading +storeMoves = MkReading "[ASR·PFV] {review: OBJ} [ASR·HAB]/rel1 {reviews: OBJ}" "the store moves reviews and sign-offs out of SQLite, which is what it does from now on" + +-- | The review-store relative clause read as a migration that already happened. +storeMoved :: Reading +storeMoved = MkReading "[ASR·PFV] {review: OBJ} [ASR·PFV·ONE]/rel1 {reviews: OBJ}" "reviews and sign-offs were moved out of SQLite once, a migration that already happened" diff --git a/dreamstop-openfp-net-web/src/Site/Page.hs b/dreamstop-openfp-net-web/src/Site/Page.hs index 2bfec8f..6878c6a 100644 @@ -24,7 +24,7 @@ page = , pageTitle = name <> " — " <> tagline , pageDescription = description , pageIcon = Just "dreamstop.svg" - , pageStylesheets = ["design-kit/design-kit.css", "dreamstop.css"] + , pageStylesheets = ["design-kit/design-kit.css", "dreamstop.css", "codepoints.css"] , pageBundle = "site.js" , pageCard = Just @@ -57,4 +57,4 @@ tagline = "a language for continuous disambiguation" -- -- @since 0.1.0.0 description :: MisoString -description = "dreamstop is a language for continuous disambiguation. Readers annotate each sentence, and authors rewrite any sentence that is not clear." +description = "dreamstop is a language for continuous disambiguation. A program marks up every clause with codepoints, and authors rewrite any sentence that is not clear." diff --git a/dreamstop-openfp-net-web/src/Site/View.hs b/dreamstop-openfp-net-web/src/Site/View.hs index 7ef65a5..905d322 100644 @@ -10,20 +10,23 @@ module Site.View , app ) where +import Data.Char (isUpper) import Data.Kind (Type) +import Data.List (groupBy) import DesignKit.Brand (fontDisplay, gradientText) import DesignKit.Effects (scrollProgressBar) import Miso (App, Effect, component) import Miso.Html.Element (a_, blockquote_, code_, div_, footer_, h1_, - h2_, h3_, header_, li_, nav_, p_, section_, - span_, ul_) + h2_, h3_, header_, li_, nav_, ol_, p_, + section_, span_, ul_) import Miso.Html.Property (aria_, href_, id_) import Miso.Property (classList) +import Miso.String (MisoString, fromMisoString, toMisoString) import Miso.Types (View, text) -import Site.Content (Side (sideAnnotation, sideLabel, sideSentence), - Verdict (verdictAnnotations, verdictName, verdictSentence, verdictText), - manual, package, pair, pairSlot, - repository, verdicts) +import Site.Content (Example (exampleLabel, exampleReadings, exampleSentence), + Reading (readingCodes, readingGloss), + manual, modalities, package, pair, + pairSlot, repository, verdicts) import Site.Page (name) -- | The page holds no state. @@ -74,14 +77,13 @@ view _ = , p_ [classList ["lead"]] ["dreamstop is a language for continuous disambiguation."] , p_ [] - [ "dreamstop checks that a piece of writing means one thing. \ - \An annotator, a program, marks each clause with three-letter codes that record how it reads the clause: \ + [ "dreamstop is a language for disambiguating text. \ + \It checks that a piece of writing very likely means only one thing. \ + \A program marks up every clause with three-letter codepoints that identify its grammatical meaning: \ \whether it states something or tells you to do something, whether it is done or still happening, \ \whether it is required or only allowed. \ - \A sentence is clear when every annotator marks it the same way. \ - \It is ambiguous when annotators mark it differently, or when one annotator finds two ways to read it. \ - \It is nonsense when no annotator can make sense of it. \ - \An ambiguous sentence gets rewritten until it is clear." + \A sentence is clear when there is only one way to read it. \ + \It is ambiguous when there is more than one way to read it, and it is nonsense when there is no way to read it." ] , p_ [classList ["actions"]] @@ -93,7 +95,10 @@ view _ = [ div_ [classList ["container"]] [ h2_ [classList ["section-title"], fontDisplay] ["Clear, ambiguous or nonsense"] - , ul_ [classList ["readings"]] (map verdict verdicts) + , legend + , ul_ [classList ["readings"]] (map example verdicts) + , h2_ [classList ["section-title"], fontDisplay] ["Required or only allowed"] + , ul_ [classList ["readings"]] (map example modalities) ] ] , section_ @@ -103,13 +108,12 @@ view _ = [ h2_ [classList ["section-title"], fontDisplay] ["Minimal pairs"] , p_ [] - [ "A minimal pair is a question, a bad side that leaves it open, a good side that answers it, and the smallest edit between them." ] - , ul_ [classList ["readings"]] (map side pair) + ["A minimal pair is two sentences that differ by the smallest possible edit that makes the sentence clear."] + , ul_ [classList ["readings"]] (map example pair) , p_ [classList ["annotation"]] [text pairSlot] , p_ [] - [ "This pair teaches that a ChangeLog describes the resulting state, not the migration. \ - \Each document kind is a set of patterns, specified by its pairs. \ + [ "Each document kind is a set of patterns, specified by its pairs. \ \A pattern with no pair is not part of the kind." ] , p_ @@ -140,22 +144,62 @@ view _ = wordmark :: View Model Action wordmark = a_ [classList ["wordmark"], href_ "/"] [text name] - verdict :: Verdict -> View Model Action - verdict v = + example :: Example -> View Model Action + example e = li_ [] - ( [ h3_ [] [text (verdictName v)] - , blockquote_ [classList ["entry"]] [text (verdictSentence v)] + ( [ h3_ [] [text (exampleLabel e)] + , blockquote_ [classList ["entry"]] [text (exampleSentence e)] ] - <> map (\a -> p_ [classList ["annotation"]] [code_ [] [text a]]) (verdictAnnotations v) - <> [p_ [] [text (verdictText v)]] + <> readings (exampleReadings e) ) - side :: Side -> View Model Action - side s = - li_ - [] - [ h3_ [] [text (sideLabel s)] - , blockquote_ [classList ["entry"]] [text (sideSentence s)] - , p_ [classList ["annotation"]] [code_ [] [text (sideAnnotation s)]] + readings :: [Reading] -> [View Model Action] + readings = \case + [] -> [p_ [classList ["annotation"]] ["No reading"]] + [r] -> [p_ [classList ["annotation"]] (reading r)] + rs -> + [ p_ [classList ["annotation"]] ["Readings:"] + , ol_ [classList ["annotation"]] (map (li_ [] . reading) rs) + ] + + reading :: Reading -> [View Model Action] + reading r = [codepoints (readingCodes r), text (": " <> readingGloss r)] + + legend :: View Model Action + legend = + ul_ + [classList ["legend"], aria_ "label" "Codepoint colours"] + [ li_ [classList [layerClass l]] [text l] + | l <- ["Force", "Mood", "Aspect", "Phase", "Modality", "Negation", "Bound", "Evidence", "Nominalisation"] ] + +-- | A reading's codes, each coloured by its layer, with brackets, separators +-- and positions in neutral grey. +codepoints :: MisoString -> View model action +codepoints s = + code_ [] (map token (groupBy sameCase (fromMisoString s :: String))) + where + sameCase :: Char -> Char -> Bool + sameCase a b = isUpper a == isUpper b + + token :: String -> View model action + token w = span_ [classList [maybe "cp-mark" layerClass (layer w)]] [text (toMisoString w)] + +-- | The CSS class of a layer. +layerClass :: MisoString -> MisoString +layerClass l = "cp-" <> l + +-- | The layer of a code, by the manual's reference table. +layer :: String -> Maybe MisoString +layer = \case + w | w `elem` ["ASR", "DIR", "IRG", "DEC", "ADM", "CMS"] -> Just "Force" + | w `elem` ["FAC", "HYP", "COU"] -> Just "Mood" + | w `elem` ["PFV", "PRF", "PRG", "HAB"] -> Just "Aspect" + | w `elem` ["INC", "CSS", "CNT", "EXP"] -> Just "Phase" + | w `elem` ["DEO", "ABL", "TEL", "NEC", "WNC", "POS"] -> Just "Modality" + | w == "NEG" -> Just "Negation" + | w == "ONE" -> Just "Bound" + | w `elem` ["OBS", "PUP", "RPR", "INF", "REC"] -> Just "Evidence" + | w `elem` ["BSC", "OBJ"] -> Just "Nominalisation" + | otherwise -> Nothing diff --git a/dreamstop.css b/dreamstop.css index 5fea975..9b6ed83 100644 @@ -110,9 +110,9 @@ blockquote.entry { background: var(--bg); border: 1px solid var(--hair); border-left: 4px solid var(--dk-300); border-radius: .6rem; font-style: italic; font-size: 1.15rem; color: var(--title); } -ul.readings { list-style: none; margin: 1.6rem 0; padding: 0; +ul.readings { list-style: none; margin: 1.6rem 0; padding: 0; max-width: 44rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; } -ul.readings li { background: var(--bg); border: 1px solid var(--hair); border-radius: .6rem; padding: 1.3rem 1.3rem 1rem; } +ul.readings > li { background: var(--bg); border: 1px solid var(--hair); border-radius: .6rem; padding: 1.3rem 1.3rem 1rem; } ul.readings h3 { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--title); margin: .8rem 0 .4rem; } ul.readings p { margin: .4rem 0 0; color: var(--ink); font-size: .95rem; } @@ -122,3 +122,10 @@ ul.readings code { font-family: var(--font-mono); } .wordmark { font-size: .82rem; letter-spacing: .04em; } } .annotation code, p.annotation { font-family: var(--font-mono); color: var(--muted); font-size: .85rem; } + +/* Readings: numbered when there are several. Codepoint colours come from + * codepoints.css, printed from the layer table in nix/site.nix. */ +ol.annotation { margin: .4rem 0 0; padding-left: 1.4rem; font-family: var(--font-mono); color: var(--muted); font-size: .85rem; } +ol.annotation li { margin: .3rem 0; } +ul.legend { list-style: none; margin: 1rem 0 0; padding: 0; max-width: 44rem; + display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-family: var(--font-mono); font-size: .85rem; font-weight: 700; } diff --git a/manual/dreamstop.vx b/manual/dreamstop.vx index ba2eb07..5830544 100644 @@ -15,6 +15,10 @@ let pairs = table [t "Kind", t "Question", t "Bad side", t "Good side", t "Source"] pair :: String -> String -> String -> String -> String -> String -> String -> [[Inline]] pair kind question bad badReadings good goodReading source = [t kind, t question, [text bad, text " ", inlineCode Nothing badReadings], [text good, text " ", inlineCode Nothing goodReading], t source] + readings :: String -> [Content ()] -> Content () + readings sentence items = paragraph [text sentence] >> paragraph [text "Readings:"] >> ordered items + reading :: String -> String -> Content () + reading codes gloss = paragraph [inlineCode Nothing codes, text (": " ++ gloss)] codes :: [[[Inline]]] -> Content () codes = table [t "Code", t "Meaning", t "English cues", t "Example", t "Reading"] code :: String -> String -> String -> String -> String -> [[Inline]] @@ -32,7 +36,7 @@ in do paragraph (s "[ASR·HAB]" "dreamstop secures one property." ++ s "[ASR·HAB]/rel2 [ASR·HAB]" "Every question that a reader is entitled to ask of a document has exactly one answer.") paragraph (s "[ASR·HAB]" "A document fails this property in two ways." ++ s "[ASR·HAB]" "Ambiguity of reading is a sentence with several meanings." ++ s "[ASR·HAB] [ASR·HAB]/rel1" "Ambiguity by omission is a clear text that fits several situations of concern to the reader." ++ s "[ASR·HAB] [ASR·HAB]/adv1" "Both leave a question with more than one answer, so dreamstop treats them as one failure.") table [t "Failure", t "Example", t "What it leaves open"] - [ [t "Ambiguity of reading", t "Added the review store, which moved reviews out of SQLite.", t "whether the move is a one-off import or what the store does"] + [ [t "Ambiguity of reading", t "Added the review store, which moved reviews and sign-offs out of SQLite.", t "whether the move is a one-off import or what the store does"] , [t "Ambiguity by omission", t "Upgraded nixlab-shell from 0.121.0.0 to 0.122.0.0.", t "whether operators must do anything"] ] paragraph (s "[ASR·HAB] [ASR·HAB]/rel1" "An annotator is a program that marks each clause with codes." ++ s "[ASR·HAB]" "Annotators make both failures visible." ++ s "[ASR·HAB]" "Another program checks every reading against the document's kind." ++ s "[ASR·HAB] [ASR·HAB]/adv1" "A document passes when every question of its kind has one answer for every annotator.") @@ -308,8 +312,13 @@ in do paragraph (s "[ASR·HAB] [ASR·HAB]" "One annotator with no reading beside another annotator with one reading is a disagreement, and a disagreement is ambiguity.") table [t "Sentence", t "Readings", t "Verdict"] [ [t "The shell no longer accepts unsigned commands.", c "[ASR·HAB·CSS]", t "Clear"] - , [t "Added the review store, which moved reviews out of SQLite.", c "[ASR·PFV] [ASR·PFV·ONE] or [ASR·PFV] [ASR·HAB]", t "Ambiguous"] - , [t "The shell now still accepts unsigned commands.", t "none", t "Nonsense"] + , [t "Added the review store, which moved reviews and sign-offs out of SQLite.", c "[ASR·PFV] {review: OBJ} [ASR·HAB]/rel1 {reviews: OBJ} or [ASR·PFV] {review: OBJ} [ASR·PFV·ONE]/rel1 {reviews: OBJ}", t "Ambiguous"] + , [t "Removed the legacy importer, which reads the old export format.", t "no reading", t "Nonsense"] + ] + paragraph (s "[ASR·HAB] [ASR·HAB]/rel1" "The ambiguous sentence has two readings, which differ in the relative clause." ++ s "[ASR·HAB] [ASR·HAB]/rel1" "The nonsense sentence describes a removed importer as one that reads a format.") + readings "Added the review store, which moved reviews and sign-offs out of SQLite." + [ reading "[ASR·PFV] {review: OBJ} [ASR·HAB]/rel1 {reviews: OBJ}" "the store moves reviews and sign-offs out of SQLite, which is what it does from now on" + , reading "[ASR·PFV] {review: OBJ} [ASR·PFV·ONE]/rel1 {reviews: OBJ}" "reviews and sign-offs were moved out of SQLite once, a migration that already happened" ] section (Identifier "No reading") [text "No reading"] $ do paragraph (s "[ASR·HAB]" "A pair records an annotator with no reading as no reading beside the bad side's readings." ++ s "[ASR·HAB] [ASR·HAB]/adv1" "A bad side is Nonsense when no annotator finds a reading." ++ s "[ASR·HAB] [ASR·HAB]/adv1" "It is Ambiguous when no reading stands beside one or more readings.") @@ -433,7 +442,7 @@ in do ] section (Identifier "Minimal pairs") [text "Minimal pairs"] $ do - paragraph (s "[ASR·HAB]" "Minimal pairs specify every kind." ++ s "[ASR·HAB]" "dreamstop has one kind of pair.") + paragraph (s "[ASR·HAB] [ASR·HAB]/rel1 [ASR·HAB]/rel2 {edit: OBJ}" "A minimal pair is two sentences that differ by the smallest possible edit that makes the sentence clear." ++ s "[ASR·HAB] [ASR·HAB]/comp1" "The question is what the pair settles." ++ s "[ASR·HAB]" "Minimal pairs specify every kind." ++ s "[ASR·HAB]" "dreamstop has one kind of pair.") table [t "Part", t "Content"] [ [t "Question", t "a question from the kind's set, or the sentence question"] , [t "Bad side", t "a text and its readings, which leave the question with no answer or several"] @@ -628,7 +637,7 @@ in do , definition (Identifier "Term: continuous disambiguation") [text "Continuous disambiguation"] $ paragraph (s "[ASR·HAB] {disambiguation: BSC, check: BSC, review: BSC}" "Continuous disambiguation is a check at every review for exactly one answer to each question.") , definition (Identifier "Term: corpus") [text "Corpus"] $ paragraph (s "[ASR·HAB]" "The corpus is the set of verified minimal pairs, kept as Vortex data.") , definition (Identifier "Term: document kind") [text "Document kind"] $ paragraph (s "[ASR·HAB]" "A document kind is the set of code patterns allowed for each clause position, kept in its own repository with its pairs.") - , definition (Identifier "Term: minimal pair") [text "Minimal pair"] $ paragraph (s "[ASR·HAB] {edit: OBJ}" "A minimal pair is a question, a bad side, a good side and the smallest edit between the sides.") + , definition (Identifier "Term: minimal pair") [text "Minimal pair"] $ paragraph (s "[ASR·HAB] [ASR·HAB]/rel1 [ASR·HAB]/rel2 {edit: OBJ}" "A minimal pair is two sentences that differ by the smallest possible edit that makes the sentence clear." ++ s "[ASR·HAB] [ASR·HAB]/comp1" "The question is what the pair settles.") , definition (Identifier "Term: neutral slot") [text "Neutral slot"] $ paragraph (s "[ASR·HAB] [ASR·HAB]/rel1" "A neutral slot is a slot whose codes split no reading under the pattern that marks it.") , definition (Identifier "Term: nominalisation") [text "Nominalisation"] $ paragraph (s "[ASR·HAB] [ASR·HAB]/rel1" "A nominalisation is a noun that names an act, coded BSC for the act or OBJ for the product.") , definition (Identifier "Term: normal form") [text "Normal form"] $ paragraph (s "[ASR·HAB] {rewrite: BSC}" "A normal form is a reading in the fixed order after the three rewrites.") diff --git a/nix/site.nix b/nix/site.nix index 7200ce0..6879b58 100644 @@ -29,6 +29,110 @@ local: libraryHaskellDepends = [ p.inkwell-dsl ]; }; }; + # The colour of each codepoint layer, and the codes in it, as the + # manual's reference table lists them. The front page's stylesheet and + # the manual's Typst show rules are both printed from this table. Every + # colour reaches WCAG AA (4.5:1) on the page's white and zinc-100 surfaces. + codepoints = { + layers = { + Force = { + colour = "#b91c1c"; + codes = [ + "ASR" + "DIR" + "IRG" + "DEC" + "ADM" + "CMS" + ]; + }; + Mood = { + colour = "#854d0e"; + codes = [ + "FAC" + "HYP" + "COU" + ]; + }; + Aspect = { + colour = "#1d4ed8"; + codes = [ + "PFV" + "PRF" + "PRG" + "HAB" + ]; + }; + Phase = { + colour = "#7e22ce"; + codes = [ + "INC" + "CSS" + "CNT" + "EXP" + ]; + }; + Modality = { + colour = "#047857"; + codes = [ + "DEO" + "ABL" + "TEL" + "NEC" + "WNC" + "POS" + ]; + }; + Negation = { + colour = "#be185d"; + codes = [ "NEG" ]; + }; + Bound = { + colour = "#9a3412"; + codes = [ "ONE" ]; + }; + Evidence = { + colour = "#0e7490"; + codes = [ + "OBS" + "PUP" + "RPR" + "INF" + "REC" + ]; + }; + Nominalisation = { + colour = "#3f6212"; + codes = [ + "BSC" + "OBJ" + ]; + }; + }; + # Brackets, separators and positions. + mark = "#52525b"; + }; + layerNames = builtins.attrNames codepoints.layers; + # Each layer's colour as a class, for the front page and the manual. + codepointsCss = pkgs.writeText "codepoints.css" ( + lib.concatMapStrings (l: ".cp-${l} { color: ${codepoints.layers.${l}.colour}; }\n") 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. + 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}") + '' + + lib.concatMapStrings ( + l: + "#show regex(\"\\\\b(${ + lib.concatStringsSep "|" codepoints.layers.${l}.codes + })\\\\b\"): cp(\"cp-${l}\", \"${codepoints.layers.${l}.colour}\")\n" + ) layerNames + ); manualFonts = "${pkgs.dejavu_fonts}/share/fonts"; manual = @@ -42,8 +146,10 @@ local: '' mkdir -p $out/manual ${lib.getExe' inkwellSet.inkwell-dsl "inkwell-render"} ${../manual/dreamstop.vx} \ - "$("$NIX_GHC" --print-global-package-db)" > dreamstop.typ - typst compile --font-path ${manualFonts} dreamstop.typ $out/manual/dreamstop.pdf + "$("$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 ''; @@ -64,7 +170,7 @@ local: 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."; + description = "dreamstop is a language for continuous disambiguation. A program marks up every clause with codepoints, and authors rewrite any sentence that is not clear."; card = "https://dreamstop.openfp.net/og.png"; forge = "https://nixlab.openfp.net"; meta = @@ -78,7 +184,10 @@ local: ../dreamstop.svg manual ]; - css = [ ../dreamstop.css ]; + css = [ + ../dreamstop.css + codepointsCss + ]; card = { svg = ../og.svg; extraFiles = [ ../dreamstop.svg ]; diff --git a/prose/front.vx b/prose/front.vx index 00fb3a3..043642f 100644 @@ -1,22 +1,17 @@ -- Every sentence of the dreamstop.openfp.net front page, with its dreamstop -- 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, the legend and the sentences +-- shown as examples, with their readings and glosses, 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] [ASR·HAB]/comp1" "dreamstop checks that a piece of writing means one thing." - sentence "[ASR·HAB] [ASR·HAB]/rel1 [ASR·HAB]/comp2 [ASR·HAB]/comp3 [ASR·HAB]/comp3 [ASR·HAB]/comp3 [ASR·HAB]/comp3" "An annotator, a program, marks each clause with three-letter codes that record how it reads the clause: whether it states something or tells you to do something, whether it is done or still happening, whether it is required or only allowed." - sentence "[ASR·HAB] [ASR·HAB]/adv1" "A sentence is clear when every annotator marks it the same way." - sentence "[ASR·HAB] [ASR·HAB]/adv1 [ASR·HAB]/adv1" "It is ambiguous when annotators mark it differently, or when one annotator finds two ways to read it." - sentence "[ASR·HAB] [ASR·HAB·NEG·ABL·POS]/adv1" "It is nonsense when no annotator can make sense of it." - sentence "[ASR·HAB] [ASR·HAB]/adv1" "An ambiguous sentence gets rewritten until it is clear." - sentence "[ASR·HAB]" "The sentence has one reading, the same for every reader." - sentence "[ASR·HAB] [ASR·HAB]/adv1 [ASR·HAB]/adv1" "Readers find different readings, so the author picks one and rewrites the sentence." - sentence "[ASR·HAB·NEG] [ASR·HAB]/adv1" "The sentence has no coherent reading, because now and still claim opposite histories." - sentence "[ASR·HAB] [ASR·HAB]/rel1 [ASR·HAB]/rel1 {edit: OBJ}" "A minimal pair is a question, a bad side that leaves it open, a good side that answers it, and the smallest edit between them." - sentence "[ASR·HAB] [ASR·HAB]/comp1 {migration: BSC}" "This pair teaches that a ChangeLog describes the resulting state, not the migration." + sentence "[ASR·HAB]" "dreamstop is a language for disambiguating text." + sentence "[ASR·HAB] [ASR·HAB]/comp1" "It checks that a piece of writing very likely means only one thing." + sentence "[ASR·HAB] [ASR·HAB]/rel1 [ASR·HAB]/comp2 [ASR·HAB]/comp2 [ASR·HAB]/comp2 [ASR·HAB]/comp2" "A program marks up every clause with three-letter codepoints that identify its grammatical meaning: whether it states something or tells you to do something, whether it is done or still happening, whether it is required or only allowed." + sentence "[ASR·HAB] [ASR·HAB]/adv1" "A sentence is clear when there is only one way to read it." + sentence "[ASR·HAB] [ASR·HAB]/adv1 [ASR·HAB] [ASR·HAB·NEG]/adv3" "It is ambiguous when there is more than one way to read it, and it is nonsense when there is no way to read it." + sentence "[ASR·HAB] [ASR·HAB]/rel1 [ASR·HAB]/rel2 {edit: OBJ}" "A minimal pair is two sentences that differ by the smallest possible edit that makes the sentence clear." sentence "[ASR·HAB]" "Each document kind is a set of patterns, specified by its pairs." sentence "[ASR·HAB·NEG]" "A pattern with no pair is not part of the kind." sentence "[ASR·HAB] [ASR·HAB]/comp1 {review: BSC}" "The manual covers every code, the clause positions, the verdicts, the questions, the six document kinds and how reviews use them."