summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Compat/TagSoupEntity.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-08-08 10:42:52 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2013-08-08 10:42:52 -0700
commit12e7ec40707bfb716bb9add82e4320558e065492 (patch)
tree12c6125683dadc91f33d76cf122e3fded9fff966 /src/Text/Pandoc/Compat/TagSoupEntity.hs
parent802dc9a8b9f206eb3be592ab19067f637eb2a3ee (diff)
Added Text.Pandoc.Compat.TagSoupEntity.
This allows pandoc to compile with tagsoup 0.13.x. Thanks to Dirk Ullrich for the patch.
Diffstat (limited to 'src/Text/Pandoc/Compat/TagSoupEntity.hs')
-rw-r--r--src/Text/Pandoc/Compat/TagSoupEntity.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Compat/TagSoupEntity.hs b/src/Text/Pandoc/Compat/TagSoupEntity.hs
new file mode 100644
index 000000000..80985aef9
--- /dev/null
+++ b/src/Text/Pandoc/Compat/TagSoupEntity.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE CPP #-}
+module Text.Pandoc.Compat.TagSoupEntity (lookupEntity
+ ) where
+
+import qualified Text.HTML.TagSoup.Entity as TE
+
+lookupEntity :: String -> Maybe Char
+#if MIN_VERSION_tagsoup(0,13,0)
+lookupEntity = str2chr . TE.lookupEntity
+ where str2chr :: Maybe String -> Maybe Char
+ str2chr (Just [c]) = Just c
+ str2chr _ = Nothing
+#else
+lookupEntity = TE.lookupEntity
+#endif