@@ -36,7 +36,7 @@ import Network.URI (isUnreserved, escapeURIString)
3636--------------------------------------------------------------------------------
3737-- | Map over all tags in the document
3838withTags :: (TS.Tag String -> TS.Tag String) -> String -> String
39−withTags f = renderTags' . map f . TS.parseTags
39+withTags f = renderTags' . map f . parseTags'
4040
4141
4242--------------------------------------------------------------------------------
@@ -90,6 +90,15 @@ renderTags' = TS.renderTagsOptions TS.RenderOptions
9090 ]
9191
9292
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], [])
99+ }
100+
101+
93102--------------------------------------------------------------------------------
94103-- | Convert a filepath to an URL starting from the site root
95104--