Skip to content

Commit 397ff8f

Browse files
committed
check markup validity in mangleMarkdown
1 parent 5fddc79 commit 397ff8f

26 files changed

+733
-620
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ hie.yaml
2929
*.o-boot
3030
/rubtmp*
3131

32+
*.eventlog
33+
*.prof
34+
*.html
35+
3236
# LaTeX stuff that occasionally gets generated
3337
*.log
3438
*.synctex.gz

default.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
inNixShell ? false
33
# Do we want the full Agda package for interactive use? Set to false in CI
44
, interactive ? true
5+
# Do we only want GHC?
6+
, ghcOnly ? false
57
, system ? builtins.currentSystem
68
}:
79
let
@@ -68,7 +70,7 @@ in
6870
".github"
6971
] ./.;
7072

71-
nativeBuildInputs = deps;
73+
nativeBuildInputs = if ghcOnly then [ our-ghc ] else deps;
7274

7375
shellHook = ''
7476
export out=_build/site

src/1Lab/Equiv.lagda.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ x_1$. This square _also_ has a filler, connecting $\pi_0$ and $\pi_1$
562562
over the line $g\ y ≡ \pi\ i$.
563563

564564
<div class=mathpar>
565+
565566
~~~{.quiver}
566567
\[\begin{tikzcd}
567568
{g\ y} && {g\ y} \\

src/Cat/Instances/MarkedGraphs.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ instead, which we encode in Agda via the following higher-inductive type.
317317
→ Marking p q → Marking r s
318318
→ Marking (p ++ r) (q ++ s)
319319
trunc : ∀ {x y} {p q : Path-in G.graph x y} → is-prop (Marking p q)
320-
```
320+
```
321321

322322
<!--
323323
```agda

src/Data/Char/Base.lagda.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ open P public renaming
4747
instance
4848
Discrete-Char : Discrete Char
4949
Discrete-Char = Discrete-inj' _ (primCharToNatInjective _ _)
50+
```

src/Meta/Traversable.lagda.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ sequence
4040
{a : Type ℓ}
4141
→ F.₀ (M.₀ a) → M.₀ (F.₀ a)
4242
sequence = traverse id
43+
```

support/shake/app/Definitions.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ import Development.Shake
4141

4242
import GHC.Generics (Generic)
4343

44-
import HTML.Backend (moduleName)
4544

4645
import Text.Pandoc.Walk
4746
import Text.Pandoc
4847

49-
import {-# SOURCE #-} Shake.Markdown (readLabMarkdown)
48+
import Shake.Modules (moduleName, getOurModules, ModKind (WithText), markdownSource)
5049
import Shake.Digest (shortDigest)
5150

5251
newtype Mangled = Mangled { getMangled :: Text }
@@ -66,9 +65,9 @@ mangleLink = doit where
6665
wordChar '[' = True
6766
wordChar c = isAsciiLower c || isDigit c
6867

69-
parseDefinitions :: MonadIO m => FilePath -> FilePath -> m Glossary
70-
parseDefinitions anchor input = liftIO do
71-
Pandoc _meta markdown <- readLabMarkdown input
68+
parseDefinitions :: MonadIO m => (FilePath -> m Pandoc) -> FilePath -> FilePath -> m Glossary
69+
parseDefinitions read anchor input = do
70+
Pandoc _meta markdown <- read input
7271
pure $ appEndo (query (definitionBlock input anchor) markdown) (Glossary mempty)
7372

7473
data Definition = Definition
@@ -138,17 +137,18 @@ addDefinition key@(getMangled -> keyt) def (Glossary ge) = Glossary (go False ke
138137
definitionTarget :: Definition -> Text
139138
definitionTarget def = Text.pack (definitionModule def) <> ".html#" <> definitionAnchor def
140139

141-
glossaryRules :: Rules ()
142-
glossaryRules = do
140+
glossaryRules :: (FilePath -> Action Pandoc) -> Rules ()
141+
glossaryRules read = do
143142
_ <- addOracleCache \(ModuleGlossaryQ fp) -> do
144143
need [fp]
145144
let modn = moduleName (dropExtensions (dropDirectory1 fp)) <.> "html"
146-
traced "parsing definitions" (parseDefinitions modn fp)
145+
parseDefinitions read modn fp
147146

148147
_ <- addOracle \GlossaryQ -> do
149-
md <- fmap ("src" </>) <$> getDirectoryFiles "src" ["**/*.lagda.md"]
150-
need md
151-
outs <- askOracles (ModuleGlossaryQ <$> md)
148+
mods <- Map.keys . Map.filter (== WithText) <$> getOurModules
149+
files <- traverse markdownSource mods
150+
need files
151+
outs <- askOracles (ModuleGlossaryQ <$> files)
152152

153153
let
154154
alldefs :: [(Mangled, Definition)]

0 commit comments

Comments
 (0)