only walk once
This commit is contained in:
parent
6c9d04489c
commit
b1ef3fc82d
1 changed files with 7 additions and 12 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue