summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-05-11 20:14:11 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-05-11 20:14:11 -0700
commit5dfcf004b414098a91e42eeedd17a6565a8112a1 (patch)
tree4909297489fb33e21d8726cbc3cc57b2c236d2ac /src/Text
parentde27dbc0f8fd31cc428468e75b129bd751e03f43 (diff)
DocBook reader: Use ALLCAPS for unknown entities.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 60d27afc6..a74dced6b 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -525,17 +525,16 @@ normalizeTree = everywhere (mkT go)
go (Text (CData CDataText s1 z):Text (CData CDataText s2 _):xs) =
Text (CData CDataText (s1 ++ s2) z):xs
go (Text (CData CDataText s1 z):CRef r:xs) =
- Text (CData CDataText (s1 ++ [c]) z):xs
- where c = maybe '?' id (lookupEntity r)
+ Text (CData CDataText (s1 ++ convertEntity r) z):xs
go (CRef r:Text (CData CDataText s1 z):xs) =
- Text (CData CDataText ([c] ++ s1) z):xs
- where c = maybe '?' id (lookupEntity r)
+ Text (CData CDataText (convertEntity r ++ s1) z):xs
go (CRef r1:CRef r2:xs) =
- Text (CData CDataText [c1,c2] Nothing):xs
- where c1 = maybe '?' id (lookupEntity r1)
- c2 = maybe '?' id (lookupEntity r2)
+ Text (CData CDataText (convertEntity r1 ++ convertEntity r2) Nothing):xs
go xs = xs
+convertEntity :: String -> String
+convertEntity e = maybe (map toUpper e) (:[]) (lookupEntity e)
+
-- convenience function to get an attribute value, defaulting to ""
attrValue :: String -> Element -> String
attrValue attr elt =