git.iko.soy/typeable/pandoc
on master help sign in
Re-added the --ascii option.
bec9485John MacFarlane
@@ -333,6 +333,11 @@ Options affecting specific writers
333: Produce HTML5 instead of HTML4. This option has no effect for writers
333: Produce HTML5 instead of HTML4. This option has no effect for writers
334 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
334 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
335
335
336+`--ascii`
337+: Use only ascii characters in output. Currently supported only
338+ for HTML output (which uses numerical entities instead of
339+ UTF-8 when this option is selected).
340+
336`--reference-links`
341`--reference-links`
337: Use reference-style links, rather than inline links, in writing markdown
342: Use reference-style links, rather than inline links, in writing markdown
338 or reStructuredText. By default inline links are used.
343 or reStructuredText. By default inline links are used.
changelog−3
@@ -178,9 +178,6 @@ pandoc (1.9)
178 * `'` is no longer escaped in HTML output. It does not need to be
178 * `'` is no longer escaped in HTML output. It does not need to be
179 escaped outside of attributes.
179 escaped outside of attributes.
180
180
181− * The `--ascii` option has been removed, because of differences
182− in blaze-html's and xhtml's escaping.
183−
184 * Pandoc will no longer transform leading newlines in code
181 * Pandoc will no longer transform leading newlines in code
185 blocks to `<br/>` tags.
182 blocks to `<br/>` tags.
186
183
src/pandoc.hs+18−5
@@ -134,6 +134,7 @@ data Opt = Opt
134 , optLaTeXEngine :: String -- ^ Program to use for latex -> pdf
134 , optLaTeXEngine :: String -- ^ Program to use for latex -> pdf
135 , optSlideLevel :: Maybe Int -- ^ Header level that creates slides
135 , optSlideLevel :: Maybe Int -- ^ Header level that creates slides
136 , optSetextHeaders :: Bool -- ^ Use atx headers for markdown level 1-2
136 , optSetextHeaders :: Bool -- ^ Use atx headers for markdown level 1-2
137+ , optAscii :: Bool -- ^ Use ascii characters only in html
137 }
138 }
138
139
139-- | Defaults for command-line options.
140-- | Defaults for command-line options.
@@ -185,6 +186,7 @@ defaultOpts = Opt
185 , optLaTeXEngine = "pdflatex"
186 , optLaTeXEngine = "pdflatex"
186 , optSlideLevel = Nothing
187 , optSlideLevel = Nothing
187 , optSetextHeaders = True
188 , optSetextHeaders = True
189+ , optAscii = False
188 }
190 }
189
191
190-- | A list of functions, each transforming the options data structure
192-- | A list of functions, each transforming the options data structure
@@ -412,6 +414,11 @@ options =
412 return opt { optHtml5 = True }))
414 return opt { optHtml5 = True }))
413 "" -- "Produce HTML5 in HTML output"
415 "" -- "Produce HTML5 in HTML output"
414
416
417+ , Option "" ["ascii"]
418+ (NoArg
419+ (\opt -> return opt { optAscii = True }))
420+ "" -- "Use ascii characters only in HTML output"
421+
415 , Option "" ["reference-links"]
422 , Option "" ["reference-links"]
416 (NoArg
423 (NoArg
417 (\opt -> return opt { optReferenceLinks = True } ))
424 (\opt -> return opt { optReferenceLinks = True } ))
@@ -796,6 +803,7 @@ main = do
796 , optLaTeXEngine = latexEngine
803 , optLaTeXEngine = latexEngine
797 , optSlideLevel = slideLevel
804 , optSlideLevel = slideLevel
798 , optSetextHeaders = setextHeaders
805 , optSetextHeaders = setextHeaders
806+ , optAscii = ascii
799 } = opts
807 } = opts
800
808
801 when dumpArgs $
809 when dumpArgs $
@@ -1027,10 +1035,15 @@ main = do
1027 case res of
1035 case res of
1028 Right pdf -> writeBinary pdf
1036 Right pdf -> writeBinary pdf
1029 Left err' -> err 43 $ toString err'
1037 Left err' -> err 43 $ toString err'
1038+ Just r
1039+ | htmlFormat && ascii ->
1040+ writerFn outputFile =<< selfcontain (toEntities result)
1041+ | otherwise ->
1030− Just r -> writerFn outputFile =<< postProcess result
1042+ writerFn outputFile =<< selfcontain result
1031 where result = r writerOptions doc2 ++ ['\n' | not standalone']
1043 where result = r writerOptions doc2 ++ ['\n' | not standalone']
1044+ htmlFormat = writerName' `elem`
1032− htmlFormats = ["html","html+lhs","html5","html5+lhs",
1045+ ["html","html+lhs","html5","html5+lhs",
1033 "s5","slidy","dzslides"]
1046 "s5","slidy","dzslides"]
1034− postProcess = if selfContained && writerName' `elem` htmlFormats
1047+ selfcontain = if selfContained && htmlFormat
1035− then makeSelfContained datadir
1048+ then makeSelfContained datadir
1036− else return
1049+ else return