@@ -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
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"
300+ , Option "" ["lhs-out"]
302+ (\opt -> return opt { optLHSOut = True }))
303+ "" -- "Write output as literate haskell"
307+ (\opt -> return opt { optLHSIn = True,
308+ optLHSOut = True }))
309+ "" -- "Equivalent to --lhs-in --lhs-out"
298 , Option "" ["toc", "table-of-contents"]
311 , Option "" ["toc", "table-of-contents"]
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] }
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" ++