summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-12-02 22:42:16 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-12-02 22:42:16 +0000
commit48410d1df03a79d0c9b9a26c761d80f13e51aead (patch)
treebabf9846d15eca51cfae2236cc343dcb0ecddc2e /Main.hs
parentc815c2feabe76d32d10161fee69d296d6736bca9 (diff)
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
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs44
1 files changed, 30 insertions, 14 deletions
diff --git a/Main.hs b/Main.hs
index 3237398ef..28c7fba62 100644
--- a/Main.hs
+++ b/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" ++