@@ -869,62 +869,54 @@ pSpace = many1 (satisfy isSpace) >>= \xs ->
869869-- Constants
870870--
871871
872−eitherBlockOrInline :: [String]
873−eitherBlockOrInline = ["audio", "applet", "button", "iframe", "embed",
874− "del", "ins",
875− "progress", "map", "area", "noscript", "script",
876− "object", "svg", "video", "source"]
877−
878−{-
879−inlineHtmlTags :: [[Char]]
880−inlineHtmlTags = ["a", "abbr", "acronym", "b", "basefont", "bdo", "big",
881− "br", "cite", "code", "dfn", "em", "font", "i", "img",
882− "input", "kbd", "label", "q", "s", "samp", "select",
883− "small", "span", "strike", "strong", "sub", "sup",
884− "textarea", "tt", "u", "var"]
885−-}
886−
887−blockHtmlTags :: [String]
888−blockHtmlTags = ["?xml", "!DOCTYPE", "address", "article", "aside",
889− "blockquote", "body", "canvas",
890− "caption", "center", "col", "colgroup", "dd", "details",
891− "dir", "div",
892− "dl", "dt", "fieldset", "figcaption", "figure",
893− "footer", "form", "h1", "h2", "h3", "h4",
894− "h5", "h6", "head", "header", "hgroup", "hr", "html",
895− "isindex", "menu", "noframes", "ol", "output", "p", "pre",
896− "section", "table", "tbody", "textarea",
897− "thead", "tfoot", "ul", "dd",
898− "dt", "frameset", "li", "tbody", "td", "tfoot",
899− "th", "thead", "tr", "script", "style"]
872+eitherBlockOrInline :: Set.Set String
873+eitherBlockOrInline = Set.fromList
874+ ["audio", "applet", "button", "iframe", "embed",
875+ "del", "ins", "progress", "map", "area", "noscript", "script",
876+ "object", "svg", "video", "source"]
877+
878+blockHtmlTags :: Set.Set String
879+blockHtmlTags = Set.fromList
880+ ["?xml", "!DOCTYPE", "address", "article", "aside",
881+ "blockquote", "body", "canvas",
882+ "caption", "center", "col", "colgroup", "dd", "details",
883+ "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure",
884+ "footer", "form", "h1", "h2", "h3", "h4",
885+ "h5", "h6", "head", "header", "hgroup", "hr", "html",
886+ "isindex", "menu", "noframes", "ol", "output", "p", "pre",
887+ "section", "table", "tbody", "textarea",
888+ "thead", "tfoot", "ul", "dd",
889+ "dt", "frameset", "li", "tbody", "td", "tfoot",
890+ "th", "thead", "tr", "script", "style"]
900891
901892-- We want to allow raw docbook in markdown documents, so we
902893-- include docbook block tags here too.
903−blockDocBookTags :: [String]
904−blockDocBookTags = ["calloutlist", "bibliolist", "glosslist", "itemizedlist",
905− "orderedlist", "segmentedlist", "simplelist",
906− "variablelist", "caution", "important", "note", "tip",
907− "warning", "address", "literallayout", "programlisting",
908− "programlistingco", "screen", "screenco", "screenshot",
909− "synopsis", "example", "informalexample", "figure",
910− "informalfigure", "table", "informaltable", "para",
911− "simpara", "formalpara", "equation", "informalequation",
912− "figure", "screenshot", "mediaobject", "qandaset",
913− "procedure", "task", "cmdsynopsis", "funcsynopsis",
914− "classsynopsis", "blockquote", "epigraph", "msgset",
915− "sidebar", "title"]
916−
917−epubTags :: [String]
918−epubTags = ["case", "switch", "default"]
919−
920−blockTags :: [String]
921−blockTags = blockHtmlTags ++ blockDocBookTags ++ epubTags
894+blockDocBookTags :: Set.Set String
895+blockDocBookTags = Set.fromList
896+ ["calloutlist", "bibliolist", "glosslist", "itemizedlist",
897+ "orderedlist", "segmentedlist", "simplelist",
898+ "variablelist", "caution", "important", "note", "tip",
899+ "warning", "address", "literallayout", "programlisting",
900+ "programlistingco", "screen", "screenco", "screenshot",
901+ "synopsis", "example", "informalexample", "figure",
902+ "informalfigure", "table", "informaltable", "para",
903+ "simpara", "formalpara", "equation", "informalequation",
904+ "figure", "screenshot", "mediaobject", "qandaset",
905+ "procedure", "task", "cmdsynopsis", "funcsynopsis",
906+ "classsynopsis", "blockquote", "epigraph", "msgset",
907+ "sidebar", "title"]
908+
909+epubTags :: Set.Set String
910+epubTags = Set.fromList ["case", "switch", "default"]
911+
912+blockTags :: Set.Set String
913+blockTags = Set.unions [blockHtmlTags, blockDocBookTags, epubTags]
922914
923915isInlineTag :: Tag String -> Bool
924916isInlineTag t = tagOpen isInlineTagName (const True) t ||
925917 tagClose isInlineTagName t ||
926918 tagComment (const True) t
927− where isInlineTagName x = x `notElem` blockTags
919+ where isInlineTagName x = x `Set.notMember` blockTags
928920
929921isBlockTag :: Tag String -> Bool
930922isBlockTag t = tagOpen isBlockTagName (const True) t ||
@@ -976,8 +968,9 @@ t `closes` t2 |
976968 t `elem` ["h1","h2","h3","h4","h5","h6","dl","ol","ul","table","div","p"] &&
977969 t2 `elem` ["h1","h2","h3","h4","h5","h6","p" ] = True -- not "div"
978970t1 `closes` t2 |
979− t1 `elem` blockTags &&
980− t2 `notElem` (blockTags ++ eitherBlockOrInline) = True
971+ t1 `Set.member` blockTags &&
972+ t2 `Set.notMember` blockTags &&
973+ t2 `Set.notMember` eitherBlockOrInline = True
981974_ `closes` _ = False
982975
983976--- parsers for use in markdown, textile readers