git.iko.soy/typeable/pandoc
on master help sign in
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

commit48410d1df03a79d0c9b9a26c761d80f13e51aead authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateTue 2 Dec 2008, 22:42 (18 years ago) parentc815c2f
2 files changed+32−14
Main.hs+30−14 Text/Pandoc/Shared.hs+2
Main.hs+30−14
@@ -147,6 +147,7 @@ data Opt = Opt
147147 , optWrapText :: Bool -- ^ Wrap text
148148 , optSanitizeHTML :: Bool -- ^ Sanitize HTML
149149 , optLHSIn :: Bool -- ^ Treat input as literate haskell
150+ , optLHSOut :: Bool -- ^ Write output as literate haskell
150151#ifdef _CITEPROC
151152 , optModsFile :: String
152153 , optCslFile :: String
@@ -181,6 +182,7 @@ defaultOpts = Opt
181182 , optWrapText = True
182183 , optSanitizeHTML = False
183184 , optLHSIn = False
185+ , optLHSOut = False
184186#ifdef _CITEPROC
185187 , optModsFile = []
186188 , optCslFile = []
@@ -295,6 +297,17 @@ options =
295297 (\opt -> return opt { optLHSIn = True }))
296298 "" -- "Treat input as literate haskell"
297299
300+ , Option "" ["lhs-out"]
301+ (NoArg
302+ (\opt -> return opt { optLHSOut = True }))
303+ "" -- "Write output as literate haskell"
304+
305+ , Option "" ["lhs"]
306+ (NoArg
307+ (\opt -> return opt { optLHSIn = True,
308+ optLHSOut = True }))
309+ "" -- "Equivalent to --lhs-in --lhs-out"
310+
298311 , Option "" ["toc", "table-of-contents"]
299312 (NoArg
300313 (\opt -> return opt { optTableOfContents = True }))
@@ -511,6 +524,7 @@ main = do
511524 , optWrapText = wrap
512525 , optSanitizeHTML = sanitize
513526 , optLHSIn = lhsIn
527+ , optLHSOut = lhsOut
514528#ifdef _CITEPROC
515529 , optModsFile = modsFile
516530 , optCslFile = cslFile
@@ -591,23 +605,25 @@ main = do
591605 let header = (if (customHeader == "DEFAULT")
592606 then defaultHeader
593607 else customHeader) ++ csslink ++ includeHeader
594− let writerOptions = WriterOptions { writerStandalone = standalone',
595− writerHeader = header,
596− writerTitlePrefix = titlePrefix,
597− writerTabStop = tabStop,
608+ let writerOptions = WriterOptions { writerStandalone = standalone',
609+ writerHeader = header,
610+ writerTitlePrefix = titlePrefix,
611+ writerTabStop = tabStop,
598612 writerTableOfContents = toc &&
599613 (not strict) &&
600614 writerName' /= "s5",
601− writerHTMLMathMethod = mathMethod,
602− writerS5 = (writerName' == "s5"),
603− writerIgnoreNotes = False,
604− writerIncremental = incremental,
605− writerNumberSections = numberSections,
606− writerIncludeBefore = includeBefore,
607− writerIncludeAfter = includeAfter,
608− writerStrictMarkdown = strict,
609− writerReferenceLinks = referenceLinks,
610− writerWrapText = wrap }
615+ writerHTMLMathMethod = mathMethod,
616+ writerS5 = (writerName' == "s5"),
617+ writerIgnoreNotes = False,
618+ writerIncremental = incremental,
619+ writerNumberSections = numberSections,
620+ writerIncludeBefore = includeBefore,
621+ writerIncludeAfter = includeAfter,
622+ writerStrictMarkdown = strict,
623+ writerReferenceLinks = referenceLinks,
624+ writerWrapText = wrap,
625+ writerLiterateHaskell = lhsOut ||
626+ lhsExtension [outputFile] }
611627
612628 if isNonTextOutput writerName' && outputFile == "-"
613629 then do hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" ++
Text/Pandoc/Shared.hs+2
@@ -901,6 +901,7 @@ data WriterOptions = WriterOptions
901901 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
902902 , writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
903903 , writerWrapText :: Bool -- ^ Wrap text to line length
904+ , writerLiterateHaskell :: Bool -- ^ Write as literate haskell
904905 } deriving Show
905906
906907-- | Default writer options.
@@ -921,6 +922,7 @@ defaultWriterOptions =
921922 , writerStrictMarkdown = False
922923 , writerReferenceLinks = False
923924 , writerWrapText = True
925+ , writerLiterateHaskell = False
924926 }
925927
926928--