summaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-03-09 10:32:32 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-03-09 10:32:32 -0800
commit9766b532f38266d0606520fcbfb0c13fd5b09a2f (patch)
tree9357603e8e3ad600e75dc72bd93d2731f61f1b6d /src/pandoc.hs
parent6787cf2fbf32a59fcf70d09ed2f2ffe12f642d0a (diff)
Added beamer+lhs as output format.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 3853d360a..be65c8856 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -833,10 +833,12 @@ main = do
let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
+ let laTeXOutput = writerName' == "latex" || writerName' == "beamer" ||
+ writerName' == "latex+lhs" || writerName' == "beamer+lhs"
+
when pdfOutput $ do
-- make sure writer is latex or beamer
- unless (writerName' == "latex" || writerName' == "beamer" ||
- writerName' == "latex+lhs") $
+ unless laTeXOutput $
err 47 $ "cannot produce pdf output with " ++ writerName' ++ " writer"
-- check for latex program
mbLatex <- findExecutable latexEngine
@@ -916,14 +918,13 @@ main = do
lhsExtension sources,
stateStandalone = standalone',
stateCitations = map CSL.refId refs,
- stateSmart = smart || writerName' `elem`
- ["latex", "context", "latex+lhs", "beamer"],
+ stateSmart = smart || laTeXOutput || writerName' == "context",
stateOldDashes = oldDashes,
stateColumns = columns,
stateStrict = strict,
stateIndentedCodeClasses = codeBlockClasses,
- stateApplyMacros = writerName' `notElem`
- ["latex", "latex+lhs", "beamer"] }
+ stateApplyMacros = not laTeXOutput
+ }
let writerOptions = defaultWriterOptions
{ writerStandalone = standalone',
@@ -945,8 +946,7 @@ main = do
writerReferenceLinks = referenceLinks,
writerWrapText = wrap,
writerColumns = columns,
- writerLiterateHaskell = "+lhs" `isSuffixOf` writerName' ||
- lhsExtension [outputFile],
+ writerLiterateHaskell = False,
writerEmailObfuscation = if strict
then ReferenceObfuscation
else obfuscationMethod,
@@ -957,7 +957,7 @@ main = do
slideVariant == DZSlides,
writerChapters = chapters,
writerListings = listings,
- writerBeamer = writerName' == "beamer",
+ writerBeamer = False,
writerSlideLevel = slideLevel,
writerHighlight = highlight,
writerHighlightStyle = highlightStyle,
@@ -980,9 +980,7 @@ main = do
let convertTabs = tabFilter (if preserveTabs then 0 else tabStop)
- let handleIncludes' = if readerName' == "latex" || readerName' == "beamer" ||
- readerName' == "latex+lhs" ||
- readerName' == "context"
+ let handleIncludes' = if readerName' == "latex" || readerName' == "latex+lhs"
then handleIncludes
else return
@@ -1029,18 +1027,18 @@ main = do
| writerName' == "docx" ->
writeDocx referenceDocx writerOptions doc2 >>= writeBinary
| otherwise -> err 9 ("Unknown writer: " ++ writerName')
- Just _
+ Just w
| pdfOutput -> do
- res <- tex2pdf latexEngine $ writeLaTeX writerOptions doc2
+ res <- tex2pdf latexEngine $ w writerOptions doc2
case res of
Right pdf -> writeBinary pdf
Left err' -> err 43 $ toString err'
- Just r
+ Just w
| htmlFormat && ascii ->
writerFn outputFile =<< selfcontain (toEntities result)
| otherwise ->
writerFn outputFile =<< selfcontain result
- where result = r writerOptions doc2 ++ ['\n' | not standalone']
+ where result = w writerOptions doc2 ++ ['\n' | not standalone']
htmlFormat = writerName' `elem`
["html","html+lhs","html5","html5+lhs",
"s5","slidy","dzslides"]