git.iko.soy/typeable/pandoc
on master help sign in
Added --lhs-out option.
48410d1fiddlosopher
Main.hs+30−14
@@ -147,6 +147,7 @@ data Opt = Opt
147 , optWrapText :: Bool -- ^ Wrap text
147 , optWrapText :: Bool -- ^ Wrap text
148 , optSanitizeHTML :: Bool -- ^ Sanitize HTML
148 , optSanitizeHTML :: Bool -- ^ Sanitize HTML
149 , optLHSIn :: Bool -- ^ Treat input as literate haskell
149 , optLHSIn :: Bool -- ^ Treat input as literate haskell
150+ , optLHSOut :: Bool -- ^ Write output as literate haskell
150#ifdef _CITEPROC
151#ifdef _CITEPROC
151 , optModsFile :: String
152 , optModsFile :: String
152 , optCslFile :: String
153 , optCslFile :: String
@@ -181,6 +182,7 @@ defaultOpts = Opt
181 , optWrapText = True
182 , optWrapText = True
182 , optSanitizeHTML = False
183 , optSanitizeHTML = False
183 , optLHSIn = False
184 , optLHSIn = False
185+ , optLHSOut = False
184#ifdef _CITEPROC
186#ifdef _CITEPROC
185 , optModsFile = []
187 , optModsFile = []
186 , optCslFile = []
188 , optCslFile = []
@@ -295,6 +297,17 @@ options =
295 (\opt -> return opt { optLHSIn = True }))
297 (\opt -> return opt { optLHSIn = True }))
296 "" -- "Treat input as literate haskell"
298 "" -- "Treat input as literate haskell"
297
299
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+
298 , Option "" ["toc", "table-of-contents"]
311 , Option "" ["toc", "table-of-contents"]
299 (NoArg
312 (NoArg
300 (\opt -> return opt { optTableOfContents = True }))
313 (\opt -> return opt { optTableOfContents = True }))
@@ -511,6 +524,7 @@ main = do
511 , optWrapText = wrap
524 , optWrapText = wrap
512 , optSanitizeHTML = sanitize
525 , optSanitizeHTML = sanitize
513 , optLHSIn = lhsIn
526 , optLHSIn = lhsIn
527+ , optLHSOut = lhsOut
514#ifdef _CITEPROC
528#ifdef _CITEPROC
515 , optModsFile = modsFile
529 , optModsFile = modsFile
516 , optCslFile = cslFile
530 , optCslFile = cslFile
@@ -591,23 +605,25 @@ main = do
591 let header = (if (customHeader == "DEFAULT")
605 let header = (if (customHeader == "DEFAULT")
592 then defaultHeader
606 then defaultHeader
593 else customHeader) ++ csslink ++ includeHeader
607 else customHeader) ++ csslink ++ includeHeader
594− let writerOptions = WriterOptions { writerStandalone = standalone',
608+ let writerOptions = WriterOptions { writerStandalone = standalone',
595− writerHeader = header,
609+ writerHeader = header,
596− writerTitlePrefix = titlePrefix,
610+ writerTitlePrefix = titlePrefix,
597− writerTabStop = tabStop,
611+ writerTabStop = tabStop,
598 writerTableOfContents = toc &&
612 writerTableOfContents = toc &&
599 (not strict) &&
613 (not strict) &&
600 writerName' /= "s5",
614 writerName' /= "s5",
601− writerHTMLMathMethod = mathMethod,
615+ writerHTMLMathMethod = mathMethod,
602− writerS5 = (writerName' == "s5"),
616+ writerS5 = (writerName' == "s5"),
603− writerIgnoreNotes = False,
617+ writerIgnoreNotes = False,
604− writerIncremental = incremental,
618+ writerIncremental = incremental,
605− writerNumberSections = numberSections,
619+ writerNumberSections = numberSections,
606− writerIncludeBefore = includeBefore,
620+ writerIncludeBefore = includeBefore,
607− writerIncludeAfter = includeAfter,
621+ writerIncludeAfter = includeAfter,
608− writerStrictMarkdown = strict,
622+ writerStrictMarkdown = strict,
609− writerReferenceLinks = referenceLinks,
623+ writerReferenceLinks = referenceLinks,
610− writerWrapText = wrap }
624+ writerWrapText = wrap,
625+ writerLiterateHaskell = lhsOut ||
626+ lhsExtension [outputFile] }
611
627
612 if isNonTextOutput writerName' && outputFile == "-"
628 if isNonTextOutput writerName' && outputFile == "-"
613 then do hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" ++
629 then do hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" ++
Text/Pandoc/Shared.hs+2
@@ -901,6 +901,7 @@ data WriterOptions = WriterOptions
901 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
901 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
902 , writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
902 , writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
903 , writerWrapText :: Bool -- ^ Wrap text to line length
903 , writerWrapText :: Bool -- ^ Wrap text to line length
904+ , writerLiterateHaskell :: Bool -- ^ Write as literate haskell
904 } deriving Show
905 } deriving Show
905
906
906-- | Default writer options.
907-- | Default writer options.
@@ -921,6 +922,7 @@ defaultWriterOptions =
921 , writerStrictMarkdown = False
922 , writerStrictMarkdown = False
922 , writerReferenceLinks = False
923 , writerReferenceLinks = False
923 , writerWrapText = True
924 , writerWrapText = True
925+ , writerLiterateHaskell = False
924 }
926 }
925
927
926--
928--