Fills out src/Djot.hs, which was a skeleton of `error "todo"` stubs.
Three layers, so container prefixes and indentation never have to be
threaded through the parser state:
- line primitives (rawLine/peekLine/lineWhen/dedent): block parsers peek
at the next line, decide whether they want it, then consume it
- container blocks strip their prefix off the lines they own and re-parse
the result with subParse, a rank-2 helper that runs a polymorphic parser
at Identity and shifts error offsets back into the outer input
- inline content is a second pass over the text a block collected
Blocks: headings, paragraphs, block quotes, fenced code, raw blocks, divs,
tables (alignments, `^` captions, escaped pipes), footnote and reference
definitions, block attributes, thematic breaks, and lists -- bullet,
ordered (decimal/alpha/roman, `.`/`)`/`(n)`), task, and definition. Tight
lists unwrap their paragraphs to Transparent.
Inlines: emphasis and its braced forms, verbatim, raw inline, math, links,
reference links, images, autolinks, spans, footnote references, symbols,
escapes, hard breaks, attribute sets, and smart punctuation.
Two spots where the IR came up short:
- there is no reference image, so for `![alt][ref]` the label lands in
the url field
- unordered lists get style = Nothing rather than the bullet character,
which HTML.hs would otherwise emit as an invalid type="-"
Also includes the psb.cabal fix dropping OverloadedRecordUpdate, without
which Psb.Main does not build.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
59 lines
2.3 KiB
Text
59 lines
2.3 KiB
Text
cabal-version: 3.4
|
|
name: psb
|
|
|
|
-- The package version.
|
|
-- See the Haskell package versioning policy (PVP) for standards
|
|
-- guiding when and how versions should be incremented.
|
|
-- https://pvp.haskell.org
|
|
-- PVP summary: +-+------- breaking API changes
|
|
-- | | +----- non-breaking API additions
|
|
-- | | | +--- code changes with no API change
|
|
version: 0.2.0.0
|
|
|
|
license: MIT
|
|
license-file: LICENSE
|
|
|
|
author: Pagwin
|
|
maintainer: dev@pagwin.xyz
|
|
|
|
category: Web
|
|
build-type: Simple
|
|
extra-doc-files: CHANGELOG.md
|
|
description: A Static site generator I've built for my purposes
|
|
|
|
|
|
common warnings
|
|
ghc-options: -Wall
|
|
|
|
library
|
|
hs-source-dirs: src
|
|
exposed-modules: Djot Markdown HTML Logger IR Logger.Shake Psb.Main Utilities Utilities.FilePath Utilities.Action Utilities.Javascript Utilities.CSS Templates Types Config Utilities.Bundling
|
|
other-modules: Utilities.Parsing
|
|
build-depends: base, mustache >=2.4.2, shake >= 0.19.8, deriving-aeson >= 0.2.9, aeson, text >= 2.1.2, time, unordered-containers, yaml, megaparsec >= 9.7.0, transformers >= 0.6.2, bytestring
|
|
default-extensions: ApplicativeDo DataKinds NamedFieldPuns DerivingVia LambdaCase TypeApplications DeriveGeneric OverloadedRecordDot NamedFieldPuns DuplicateRecordFields DisambiguateRecordFields FlexibleInstances
|
|
|
|
test-suite test-markdown-parse
|
|
hs-source-dirs: tests
|
|
type: exitcode-stdio-1.0
|
|
main-is: Markdown/Parse.hs
|
|
build-depends: base, text, megaparsec, transformers, hedgehog, time, psb
|
|
|
|
default-extensions: ApplicativeDo DataKinds NamedFieldPuns DerivingVia LambdaCase TypeApplications DeriveGeneric OverloadedRecordDot NamedFieldPuns DuplicateRecordFields DisambiguateRecordFields FlexibleInstances
|
|
default-language: Haskell2010
|
|
|
|
|
|
executable psb
|
|
import: warnings
|
|
hs-source-dirs: app
|
|
-- .hs or .lhs file containing the Main module.
|
|
main-is: Main.hs
|
|
ghc-options: -threaded
|
|
build-depends: psb, base
|
|
|
|
|
|
-- default-extensions: ApplicativeDo DataKinds NamedFieldPuns DerivingVia LambdaCase TypeApplications DeriveGeneric OverloadedRecordDot NamedFieldPuns DuplicateRecordFields DisambiguateRecordFields FlexibleInstances
|
|
|
|
source-repository head
|
|
type: git
|
|
location: https://git.pagwin.xyz/Pagwin/psb
|
|
|