Re-added the --ascii option.
Now it is implemented in pandoc.hs, not in the HTML writer.
This commit is contained in:
parent
550b931c3c
commit
bec9485d93
3 changed files with 23 additions and 8 deletions
5
README
5
README
|
@ -333,6 +333,11 @@ Options affecting specific writers
|
|||
: Produce HTML5 instead of HTML4. This option has no effect for writers
|
||||
other than `html`. (*Deprecated:* Use the `html5` output format instead.)
|
||||
|
||||
`--ascii`
|
||||
: Use only ascii characters in output. Currently supported only
|
||||
for HTML output (which uses numerical entities instead of
|
||||
UTF-8 when this option is selected).
|
||||
|
||||
`--reference-links`
|
||||
: Use reference-style links, rather than inline links, in writing markdown
|
||||
or reStructuredText. By default inline links are used.
|
||||
|
|
|
@ -178,9 +178,6 @@ pandoc (1.9)
|
|||
* `'` is no longer escaped in HTML output. It does not need to be
|
||||
escaped outside of attributes.
|
||||
|
||||
* The `--ascii` option has been removed, because of differences
|
||||
in blaze-html's and xhtml's escaping.
|
||||
|
||||
* Pandoc will no longer transform leading newlines in code
|
||||
blocks to `<br/>` tags.
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ data Opt = Opt
|
|||
, optLaTeXEngine :: String -- ^ Program to use for latex -> pdf
|
||||
, optSlideLevel :: Maybe Int -- ^ Header level that creates slides
|
||||
, optSetextHeaders :: Bool -- ^ Use atx headers for markdown level 1-2
|
||||
, optAscii :: Bool -- ^ Use ascii characters only in html
|
||||
}
|
||||
|
||||
-- | Defaults for command-line options.
|
||||
|
@ -185,6 +186,7 @@ defaultOpts = Opt
|
|||
, optLaTeXEngine = "pdflatex"
|
||||
, optSlideLevel = Nothing
|
||||
, optSetextHeaders = True
|
||||
, optAscii = False
|
||||
}
|
||||
|
||||
-- | A list of functions, each transforming the options data structure
|
||||
|
@ -412,6 +414,11 @@ options =
|
|||
return opt { optHtml5 = True }))
|
||||
"" -- "Produce HTML5 in HTML output"
|
||||
|
||||
, Option "" ["ascii"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optAscii = True }))
|
||||
"" -- "Use ascii characters only in HTML output"
|
||||
|
||||
, Option "" ["reference-links"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optReferenceLinks = True } ))
|
||||
|
@ -796,6 +803,7 @@ main = do
|
|||
, optLaTeXEngine = latexEngine
|
||||
, optSlideLevel = slideLevel
|
||||
, optSetextHeaders = setextHeaders
|
||||
, optAscii = ascii
|
||||
} = opts
|
||||
|
||||
when dumpArgs $
|
||||
|
@ -1027,10 +1035,15 @@ main = do
|
|||
case res of
|
||||
Right pdf -> writeBinary pdf
|
||||
Left err' -> err 43 $ toString err'
|
||||
Just r -> writerFn outputFile =<< postProcess result
|
||||
Just r
|
||||
| htmlFormat && ascii ->
|
||||
writerFn outputFile =<< selfcontain (toEntities result)
|
||||
| otherwise ->
|
||||
writerFn outputFile =<< selfcontain result
|
||||
where result = r writerOptions doc2 ++ ['\n' | not standalone']
|
||||
htmlFormats = ["html","html+lhs","html5","html5+lhs",
|
||||
htmlFormat = writerName' `elem`
|
||||
["html","html+lhs","html5","html5+lhs",
|
||||
"s5","slidy","dzslides"]
|
||||
postProcess = if selfContained && writerName' `elem` htmlFormats
|
||||
then makeSelfContained datadir
|
||||
else return
|
||||
selfcontain = if selfContained && htmlFormat
|
||||
then makeSelfContained datadir
|
||||
else return
|
||||
|
|
Loading…
Add table
Reference in a new issue