diff --git a/langfilter/Main.hs b/langfilter/Main.hs index 5b94a70..73dd98b 100644 --- a/langfilter/Main.hs +++ b/langfilter/Main.hs @@ -25,14 +25,10 @@ main = toJSONFilter filter where defColor <- getDefColor m let ?lang = lang let ?defColor = defColor - pure $ - walk fixFigureClass $ - walk makeEbnf $ - walk makeQuotes $ - walk (concatMap makeBlocks) $ - walk inlineLetterList $ - walk spans $ - walk (concat . map glosses) p + let f = map (walk spans . fixFigureClass . makeEbnf . + makeQuotes . letterList) . + concatMap (makeBlocks <=< glosses) + pure $ walk f p getDefColor :: Map Text MetaValue -> IO Text getDefColor m = do @@ -86,11 +82,10 @@ makeQuotes para@(Para b) = fromMaybe para $ do checkEnd _ = empty makeQuotes other = other - -inlineLetterList :: Block -> Block -inlineLetterList (Div a@(_, cs, _) blks) +letterList :: Block -> Block +letterList (Div a@(_, cs, _) blks) | "letter-list" `elem` cs = Div a (walk go blks) where go (Para xs) = Plain xs go b = b -inlineLetterList b = b +letterList b = b