From 9766b532f38266d0606520fcbfb0c13fd5b09a2f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 9 Mar 2012 10:32:32 -0800 Subject: Added beamer+lhs as output format. --- src/pandoc.hs | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/pandoc.hs') 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"] -- cgit v1.2.3