aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Entities.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-28 00:04:43 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-28 00:04:43 +0000
commitdc6925542c6aa60078c370e7e356b42ea216b1b7 (patch)
tree2fdb83d7f353da6687377ea4f16a5ee8f059d1a2 /src/Text/Pandoc/Entities.hs
parent21484713c6745e56d92aecba620be44de8d32770 (diff)
downloadpandoc-dc6925542c6aa60078c370e7e356b42ea216b1b7.tar.gz
+ Simplified entity handling by removing stringToSGML from Entities.hs.
It is no longer needed now that all entities are processed in the markdown and HTML readers. All calls to stringToSGML have been replaced by calls to encodeEntities. + Since inTag's attribute handling already encodes entities, calls to encodeEntities are no longer needed for attribute values, so they've been removed. + The HTML and Markdown readers now call decodeEntities on all raw strings (e.g. authors, dates, link titles), to ensure that no unprocessed entities are included in the native representation of the document. (In the HTML reader, most of this work is done by a change in extractAttributeName.) + The result is a small speed improvement (around 5% on my benchmark) and cleaner code. git-svn-id: https://pandoc.googlecode.com/svn/trunk@519 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Entities.hs')
-rw-r--r--src/Text/Pandoc/Entities.hs18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/Text/Pandoc/Entities.hs b/src/Text/Pandoc/Entities.hs
index 696f943a6..e91cf3864 100644
--- a/src/Text/Pandoc/Entities.hs
+++ b/src/Text/Pandoc/Entities.hs
@@ -34,7 +34,6 @@ module Text.Pandoc.Entities (
encodeEntities,
decodeEntities,
escapeSGMLChar,
- stringToSGML,
characterEntity
) where
import Data.Char ( chr, ord )
@@ -115,23 +114,6 @@ decodeEntities str =
Left err -> error $ "\nError: " ++ show err
Right result -> result
--- | Escape string for SGML, preserving entity references.
-stringToSGML :: String -> String
-stringToSGML str =
- let regular = do
- str <- many1 (satisfy (not . needsEscaping))
- return str
- special = do
- notFollowedBy characterEntity
- c <- anyChar
- return $ escapeSGMLChar c
- entity = do
- ent <- manyTill anyChar (char ';')
- return (ent ++ ";") in
- case parse (many (regular <|> special <|> entity)) str str of
- Left err -> error $ "\nError: " ++ show err
- Right result -> concat result
-
entityTable :: [(String, Char)]
entityTable = [
("&quot;", chr 34),