Browse Source

look for references in divs

master
Amélia Liao 2 years ago
parent
commit
082b5576e7
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/Main.hs

+ 3
- 2
src/Main.hs View File

@ -16,7 +16,6 @@ import Text.HTML.TagSoup
import Text.Pandoc.Walk
import Text.Pandoc.JSON
main :: IO ()
main = toJSONFilter linkDocument
@ -63,6 +62,8 @@ parseSymbolRefs = go mempty . concat . mapMaybe getHTML where
getHTML :: Block -> Maybe ([Tag Text])
getHTML (RawBlock (Format x) xs)
| x == "html" = Just (concatMap parseTags' (parseTags xs))
getHTML (BlockQuote bs) = pure . concat $ mapMaybe getHTML bs
getHTML (Div _ bs) = pure . concat $ mapMaybe getHTML bs
getHTML _ = Nothing
parseTags' (TagComment x) = parseTags x >>= parseTags'
@ -86,4 +87,4 @@ parseSymbolRefs = go mempty . concat . mapMaybe getHTML where
go map [] = map
addIfNotPresent :: Text -> v -> HashMap Text v -> HashMap Text v
addIfNotPresent = HashMap.insertWith (\_ old -> old)
addIfNotPresent = HashMap.insertWith (\_ old -> old)

Loading…
Cancel
Save