diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-02-05 14:58:55 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-02-05 14:58:55 -0800 |
commit | bec9485d93ebcdb3d33f5c43cad09f86acb06d1d (patch) | |
tree | f3aa891a4661934ba6c924940a1b232bf4e0557d /src/pandoc.hs | |
parent | 550b931c3cf3ece7226b98aa0547efb3facdd816 (diff) |
Re-added the --ascii option.
Now it is implemented in pandoc.hs, not in the HTML writer.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r-- | src/pandoc.hs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs index aa166b7e3..2c9f2ffb8 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -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 |