summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-10-20 08:15:12 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-10-20 08:16:17 -0700
commit8193ebcd99a1f11e2ab74600ee403f6b100dac32 (patch)
tree0fa9c14bb4db027fdd241d72de9c648989169002 /pandoc.hs
parent82d2719e68a32c132055d4c0f7a755cefef63e14 (diff)
Allow use of ConTeXt to generate PDFs.
pandoc my.md -t context -o my.pdf will now create a PDF using ConTeXt rather than LaTeX. Closes #2463.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/pandoc.hs b/pandoc.hs
index ecf19dbc3..fce1a8142 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -1173,6 +1173,7 @@ main = do
let laTeXOutput = "latex" `isPrefixOf` writerName' ||
"beamer" `isPrefixOf` writerName'
+ let conTeXtOutput = "context" `isPrefixOf` writerName'
writer <- if ".lua" `isSuffixOf` writerName'
-- note: use non-lowercased version writerName
@@ -1256,7 +1257,7 @@ main = do
_ -> Nothing
let readerOpts = def{ readerSmart = smart || (texLigatures &&
- (laTeXOutput || "context" `isPrefixOf` writerName'))
+ (laTeXOutput || conTeXtOutput))
, readerStandalone = standalone'
, readerParseRaw = parseRaw
, readerColumns = columns
@@ -1367,17 +1368,20 @@ main = do
PureStringWriter f
| pdfOutput -> do
-- make sure writer is latex or beamer
- unless laTeXOutput $
+ unless (laTeXOutput || conTeXtOutput) $
err 47 $ "cannot produce pdf output with " ++ writerName' ++
" writer"
+ let texprog = if conTeXtOutput
+ then "context"
+ else latexEngine
-- check for latex program
- mbLatex <- findExecutable latexEngine
+ mbLatex <- findExecutable texprog
when (mbLatex == Nothing) $
- err 41 $ latexEngine ++ " not found. " ++
- latexEngine ++ " is needed for pdf output."
+ err 41 $ texprog ++ " not found. " ++
+ texprog ++ " is needed for pdf output."
- res <- makePDF latexEngine f writerOptions doc'
+ res <- makePDF texprog f writerOptions doc'
case res of
Right pdf -> writeBinary pdf
Left err' -> do