@@ -36,7 +36,7 @@ import Network.URI (isUnreserved, escapeURIString)
36--------------------------------------------------------------------------------
36--------------------------------------------------------------------------------
37-- | Map over all tags in the document
37-- | Map over all tags in the document
38withTags :: (TS.Tag String -> TS.Tag String) -> String -> String
38withTags :: (TS.Tag String -> TS.Tag String) -> String -> String
39−withTags f = renderTags' . map f . TS.parseTags
39+withTags f = renderTags' . map f . parseTags'
42--------------------------------------------------------------------------------
42--------------------------------------------------------------------------------
@@ -90,6 +90,15 @@ renderTags' = TS.renderTagsOptions TS.RenderOptions
93+--------------------------------------------------------------------------------
94+-- | Customized TagSoup parser: do not decode any entities.
95+parseTags' :: String -> [TS.Tag String]
96+parseTags' = TS.parseTagsOptions (TS.parseOptions :: TS.ParseOptions String)
97+ { TS.optEntityData = \(str, b) -> [TS.TagText $ "&" ++ str ++ [';' | b]]
98+ , TS.optEntityAttrib = \(str, b) -> ("&" ++ str ++ [';' | b], [])
93--------------------------------------------------------------------------------
102--------------------------------------------------------------------------------
94-- | Convert a filepath to an URL starting from the site root
103-- | Convert a filepath to an URL starting from the site root