add :::aside support

This commit is contained in:
rhiannon morris 2022-03-16 18:30:46 +01:00 committed by Rhiannon Morris
parent 3a878590c2
commit 604da055e4

View file

@ -15,17 +15,20 @@ main = toJSONFilter filter where
lang' <- toLang $ Map.lookup "conlang" m
let ?lang = lang'
fmap (walk makeEbnf .
walk (concatMap makeFigures) .
walk (concatMap makeBlocks) .
walk inlineLetterList) $
walkM spans =<<
walkM (fmap concat . traverse glosses) p
makeFigures :: Block -> [Block]
makeFigures (Div ("", ["figure"], []) blks) =
[html "<figure>"] ++ blks ++ [html "</figure>"]
where html = RawBlock (Format "html")
makeFigures b = [b]
makeBlocks :: Block -> [Block]
makeBlocks (Div ("", [cls], []) blks)
| cls `elem` ["figure", "aside"] = [open] ++ blks ++ [close]
where
open = html $ "<" <> cls <> ">"
close = html $ "</" <> cls <> ">"
html = RawBlock (Format "html")
makeBlocks b = [b]
inlineLetterList :: Block -> Block