aboutsummaryrefslogtreecommitdiff
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
parentc815c2feabe76d32d10161fee69d296d6736bca9 (diff)
downloadpandoc-48410d1df03a79d0c9b9a26c761d80f13e51aead.tar.gz
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
-rw-r--r--Main.hs44
-rw-r--r--Text/Pandoc/Shared.hs2
2 files changed, 32 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" ++
diff --git a/Text/Pandoc/Shared.hs b/Text/Pandoc/Shared.hs
index 799c35e0f..f8c5e8d17 100644
--- a/Text/Pandoc/Shared.hs
+++ b/Text/Pandoc/Shared.hs
@@ -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
}
--