Added --lhs-out option.
+ Added writerLiterateHaskell to WriterOptions. + Added --lhs-out option to Main. + Added --lhs option (combines --lhs-out and --lhs-in) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1500 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
c815c2feab
commit
48410d1df0
2 changed files with 32 additions and 14 deletions
44
Main.hs
44
Main.hs
|
@ -147,6 +147,7 @@ data Opt = Opt
|
|||
, optWrapText :: Bool -- ^ Wrap text
|
||||
, optSanitizeHTML :: Bool -- ^ Sanitize HTML
|
||||
, optLHSIn :: Bool -- ^ Treat input as literate haskell
|
||||
, optLHSOut :: Bool -- ^ Write output as literate haskell
|
||||
#ifdef _CITEPROC
|
||||
, optModsFile :: String
|
||||
, optCslFile :: String
|
||||
|
@ -181,6 +182,7 @@ defaultOpts = Opt
|
|||
, optWrapText = True
|
||||
, optSanitizeHTML = False
|
||||
, optLHSIn = False
|
||||
, optLHSOut = False
|
||||
#ifdef _CITEPROC
|
||||
, optModsFile = []
|
||||
, optCslFile = []
|
||||
|
@ -295,6 +297,17 @@ options =
|
|||
(\opt -> return opt { optLHSIn = True }))
|
||||
"" -- "Treat input as literate haskell"
|
||||
|
||||
, Option "" ["lhs-out"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optLHSOut = True }))
|
||||
"" -- "Write output as literate haskell"
|
||||
|
||||
, Option "" ["lhs"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optLHSIn = True,
|
||||
optLHSOut = True }))
|
||||
"" -- "Equivalent to --lhs-in --lhs-out"
|
||||
|
||||
, Option "" ["toc", "table-of-contents"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optTableOfContents = True }))
|
||||
|
@ -511,6 +524,7 @@ main = do
|
|||
, optWrapText = wrap
|
||||
, optSanitizeHTML = sanitize
|
||||
, optLHSIn = lhsIn
|
||||
, optLHSOut = lhsOut
|
||||
#ifdef _CITEPROC
|
||||
, optModsFile = modsFile
|
||||
, optCslFile = cslFile
|
||||
|
@ -591,23 +605,25 @@ main = do
|
|||
let header = (if (customHeader == "DEFAULT")
|
||||
then defaultHeader
|
||||
else customHeader) ++ csslink ++ includeHeader
|
||||
let writerOptions = WriterOptions { writerStandalone = standalone',
|
||||
writerHeader = header,
|
||||
writerTitlePrefix = titlePrefix,
|
||||
writerTabStop = tabStop,
|
||||
let writerOptions = WriterOptions { writerStandalone = standalone',
|
||||
writerHeader = header,
|
||||
writerTitlePrefix = titlePrefix,
|
||||
writerTabStop = tabStop,
|
||||
writerTableOfContents = toc &&
|
||||
(not strict) &&
|
||||
writerName' /= "s5",
|
||||
writerHTMLMathMethod = mathMethod,
|
||||
writerS5 = (writerName' == "s5"),
|
||||
writerIgnoreNotes = False,
|
||||
writerIncremental = incremental,
|
||||
writerNumberSections = numberSections,
|
||||
writerIncludeBefore = includeBefore,
|
||||
writerIncludeAfter = includeAfter,
|
||||
writerStrictMarkdown = strict,
|
||||
writerReferenceLinks = referenceLinks,
|
||||
writerWrapText = wrap }
|
||||
writerHTMLMathMethod = mathMethod,
|
||||
writerS5 = (writerName' == "s5"),
|
||||
writerIgnoreNotes = False,
|
||||
writerIncremental = incremental,
|
||||
writerNumberSections = numberSections,
|
||||
writerIncludeBefore = includeBefore,
|
||||
writerIncludeAfter = includeAfter,
|
||||
writerStrictMarkdown = strict,
|
||||
writerReferenceLinks = referenceLinks,
|
||||
writerWrapText = wrap,
|
||||
writerLiterateHaskell = lhsOut ||
|
||||
lhsExtension [outputFile] }
|
||||
|
||||
if isNonTextOutput writerName' && outputFile == "-"
|
||||
then do hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" ++
|
||||
|
|
|
@ -901,6 +901,7 @@ data WriterOptions = WriterOptions
|
|||
, writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
|
||||
, writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
|
||||
, writerWrapText :: Bool -- ^ Wrap text to line length
|
||||
, writerLiterateHaskell :: Bool -- ^ Write as literate haskell
|
||||
} deriving Show
|
||||
|
||||
-- | Default writer options.
|
||||
|
@ -921,6 +922,7 @@ defaultWriterOptions =
|
|||
, writerStrictMarkdown = False
|
||||
, writerReferenceLinks = False
|
||||
, writerWrapText = True
|
||||
, writerLiterateHaskell = False
|
||||
}
|
||||
|
||||
--
|
||||
|
|
Loading…
Reference in a new issue