diff --git a/langfilter/Main.hs b/langfilter/Main.hs index a96cacd..aa938a0 100644 --- a/langfilter/Main.hs +++ b/langfilter/Main.hs @@ -25,7 +25,8 @@ main = toJSONFilter filter where defColor <- getDefColor m let ?lang = lang let ?defColor = defColor - fmap (walk makeEbnf . + fmap (walk fixFigureClass . + walk makeEbnf . walk makeQuotes . walk (concatMap makeBlocks) . walk inlineLetterList) $ @@ -51,6 +52,11 @@ pluck1 [] _ = Nothing pluck1 (x:xs) ys = (x,) <$> pluck x ys <|> pluck1 xs ys +fixFigureClass :: Block -> Block +fixFigureClass (Figure (_, c1, a1) cap [Plain [Image (i, c2, a2) alt path]]) = + Figure (i, c1 ++ c2, a1 ++ a2) cap [Plain [Image ("", [], []) alt path]] +fixFigureClass b = b + makeBlocks :: Block -> [Block] makeBlocks (Div ("", clss, []) blks) | Just (cls, rest) <- pluck1 ["figure", "aside"] clss =