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