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