mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-27 09:55:57 +00:00
HTML writer: Use functions from XML module to escape strings.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1768 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
@@ -35,7 +35,7 @@ import Text.Pandoc.Shared
|
||||
import Text.Pandoc.Templates
|
||||
import Text.Pandoc.Readers.TeXMath
|
||||
import Text.Pandoc.Highlighting ( highlightHtml )
|
||||
import Text.Pandoc.XML (stripTags)
|
||||
import Text.Pandoc.XML (stripTags, escapeStringForXML)
|
||||
import Numeric ( showHex )
|
||||
import Data.Char ( ord, toLower )
|
||||
import Data.List ( isPrefixOf, intersperse )
|
||||
@@ -63,13 +63,7 @@ renderFragment opts = if writerWrapText opts
|
||||
-- | Modified version of Text.XHtml's stringToHtml.
|
||||
-- Use unicode characters wherever possible.
|
||||
stringToHtml :: String -> Html
|
||||
stringToHtml = primHtml . concatMap fixChar
|
||||
where
|
||||
fixChar '<' = "<"
|
||||
fixChar '>' = ">"
|
||||
fixChar '&' = "&"
|
||||
fixChar '"' = """
|
||||
fixChar c = [c]
|
||||
stringToHtml = primHtml . escapeStringForXML
|
||||
|
||||
-- | Convert Pandoc document to Html string.
|
||||
writeHtmlString :: WriterOptions -> Pandoc -> String
|
||||
|
||||
Reference in New Issue
Block a user