diff --git a/langfilter/Main.hs b/langfilter/Main.hs index 652c9cc..87b7e89 100644 --- a/langfilter/Main.hs +++ b/langfilter/Main.hs @@ -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 "
"] ++ blks ++ [html "
"] - 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