@@ -32,7 +32,7 @@ module Text.Pandoc.Writers.Docbook (
3232 ) where
3333import Text.Pandoc.Definition
3434import Text.Pandoc.Shared
35−import Text.Pandoc.Entities ( encodeEntities )
35+import Text.Pandoc.Entities ( escapeSGMLString )
3636import Data.Char ( toLower, ord )
3737import Data.List ( isPrefixOf, partition, drop )
3838import Text.PrettyPrint.HughesPJ hiding ( Str )
@@ -64,8 +64,8 @@ authorToDocbook name = inTagsIndented "author" $
6464 then -- last name first
6565 let (lastname, rest) = break (==',') name
6666 firstname = removeLeadingSpace rest in
67− inTagsSimple "firstname" (text $ encodeEntities firstname) <>
68− inTagsSimple "surname" (text $ encodeEntities lastname)
67+ inTagsSimple "firstname" (text $ escapeSGMLString firstname) <>
68+ inTagsSimple "surname" (text $ escapeSGMLString lastname)
6969 else -- last name last
7070 let namewords = words name
7171 lengthname = length namewords
@@ -73,8 +73,8 @@ authorToDocbook name = inTagsIndented "author" $
7373 0 -> ("","")
7474 1 -> ("", name)
7575 n -> (joinWithSep " " (take (n-1) namewords), last namewords) in
76− inTagsSimple "firstname" (text $ encodeEntities firstname) $$
77− inTagsSimple "surname" (text $ encodeEntities lastname)
76+ inTagsSimple "firstname" (text $ escapeSGMLString firstname) $$
77+ inTagsSimple "surname" (text $ escapeSGMLString lastname)
7878
7979-- | Convert Pandoc document to string in Docbook format.
8080writeDocbook :: WriterOptions -> Pandoc -> String
@@ -86,7 +86,7 @@ writeDocbook opts (Pandoc (Meta title authors date) blocks) =
8686 then inTagsIndented "articleinfo" $
8787 (inTagsSimple "title" (wrap opts title)) $$
8888 (vcat (map authorToDocbook authors)) $$
89− (inTagsSimple "date" (text $ encodeEntities date))
89+ (inTagsSimple "date" (text $ escapeSGMLString date))
9090 else empty
9191 blocks' = replaceReferenceLinks blocks
9292 (noteBlocks, blocks'') = partition isNoteBlock blocks'
@@ -141,7 +141,7 @@ blockToDocbook opts (Para lst) =
141141blockToDocbook opts (BlockQuote blocks) =
142142 inTagsIndented "blockquote" (blocksToDocbook opts blocks)
143143blockToDocbook opts (CodeBlock str) =
144− text "<screen>\n" <> text (encodeEntities str) <> text "\n</screen>"
144+ text "<screen>\n" <> text (escapeSGMLString str) <> text "\n</screen>"
145145blockToDocbook opts (BulletList lst) =
146146 inTagsIndented "itemizedlist" $ listItemsToDocbook opts lst
147147blockToDocbook opts (OrderedList lst) =
@@ -198,7 +198,7 @@ inlinesToDocbook opts lst = hcat (map (inlineToDocbook opts) lst)
198198
199199-- | Convert an inline element to Docbook.
200200inlineToDocbook :: WriterOptions -> Inline -> Doc
201−inlineToDocbook opts (Str str) = text $ encodeEntities str
201+inlineToDocbook opts (Str str) = text $ escapeSGMLString str
202202inlineToDocbook opts (Emph lst) =
203203 inTagsSimple "emphasis" (inlinesToDocbook opts lst)
204204inlineToDocbook opts (Strong lst) =
@@ -211,7 +211,7 @@ inlineToDocbook opts Ellipses = text "…"
211211inlineToDocbook opts EmDash = text "—"
212212inlineToDocbook opts EnDash = text "–"
213213inlineToDocbook opts (Code str) =
214− inTagsSimple "literal" $ text (encodeEntities str)
214+ inTagsSimple "literal" $ text (escapeSGMLString str)
215215inlineToDocbook opts (TeX str) = inlineToDocbook opts (Code str)
216216inlineToDocbook opts (HtmlInline str) = empty
217217inlineToDocbook opts LineBreak =
@@ -219,7 +219,7 @@ inlineToDocbook opts LineBreak =
219219inlineToDocbook opts Space = char ' '
220220inlineToDocbook opts (Link txt (Src src tit)) =
221221 if isPrefixOf "mailto:" src
222− then inTagsSimple "email" $ text (encodeEntities $ drop 7 src)
222+ then inTagsSimple "email" $ text (escapeSGMLString $ drop 7 src)
223223 else inTags False "ulink" [("url", src)] $ inlinesToDocbook opts txt
224224inlineToDocbook opts (Link text (Ref ref)) = empty -- shouldn't occur
225225inlineToDocbook opts (Image alt (Src src tit)) =
@@ -227,7 +227,7 @@ inlineToDocbook opts (Image alt (Src src tit)) =
227227 then empty
228228 else inTagsIndented "objectinfo" $
229229 inTagsIndented "title"
230− (text $ encodeEntities tit) in
230+ (text $ escapeSGMLString tit) in
231231 inTagsIndented "inlinemediaobject" $
232232 inTagsIndented "imageobject" $
233233 titleDoc $$ selfClosingTag "imagedata" [("fileref", src)]