aboutsummaryrefslogtreecommitdiff
path: root/Text/Pandoc/Writers/HTML.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-12-02 22:42:29 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-12-02 22:42:29 +0000
commit430e55c0f1ca94fdb20b99061862af2ceabe4469 (patch)
treedc9e433e918496ab02cef9a6769b57c054b917ab /Text/Pandoc/Writers/HTML.hs
parent48410d1df03a79d0c9b9a26c761d80f13e51aead (diff)
downloadpandoc-430e55c0f1ca94fdb20b99061862af2ceabe4469.tar.gz
Handle --lhs-out option in HTML, LaTeX, and Markdown writers.
Documented lhs options in man page and README. Note: HTML output with --lhs-out is not strictly literate haskell, but it is designed so that the result of copying and pasting the page in the browser will be a literate haskell file. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1501 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text/Pandoc/Writers/HTML.hs')
-rw-r--r--Text/Pandoc/Writers/HTML.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs
index 8dafd2440..087fff623 100644
--- a/Text/Pandoc/Writers/HTML.hs
+++ b/Text/Pandoc/Writers/HTML.hs
@@ -297,6 +297,10 @@ blockToHtml opts (Plain lst) = inlineListToHtml opts lst
blockToHtml opts (Para lst) = inlineListToHtml opts lst >>= (return . paragraph)
blockToHtml _ (RawHtml str) = return $ primHtml str
blockToHtml _ (HorizontalRule) = return $ hr
+blockToHtml opts (CodeBlock (_,classes,_) rawCode) | "haskell" `elem` classes &&
+ writerLiterateHaskell opts =
+ let classes' = map (\c -> if c == "haskell" then "literatehaskell" else c) classes
+ in blockToHtml opts $ CodeBlock ("",classes',[]) $ intercalate "\n" $ map ("> " ++) $ lines rawCode
blockToHtml _ (CodeBlock attr@(_,classes,_) rawCode) = do
case highlightHtml attr rawCode of
Left _ -> -- change leading newlines into <br /> tags, because some