From 21488b3cd0d4da37577da2544916fb7ec5d76e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abigail=20Magalh=C3=A3es?= Date: Thu, 7 Oct 2021 22:29:13 -0300 Subject: [PATCH] Look for tags inside HTML comments Enables the idiom for tricking the filter into picking the right name. --- src/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index c89b492..4fa24f0 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -62,9 +62,12 @@ parseSymbolRefs :: [Block] -> HashMap Text Reference parseSymbolRefs = go mempty . concat . mapMaybe getHTML where getHTML :: Block -> Maybe ([Tag Text]) getHTML (RawBlock (Format x) xs) - | x == "html" = Just (parseTags xs) + | x == "html" = Just (concatMap parseTags' (parseTags xs)) getHTML _ = Nothing + parseTags' (TagComment x) = parseTags x >>= parseTags' + parseTags' t = pure t + go :: HashMap Text Reference -> [Tag Text] -> HashMap Text Reference go map (TagOpen a meta:TagText t:TagClose a':xs) | a == "a"