Added --luatex
option to markdown2pdf.
This uses lualatex to create the PDF.
This commit is contained in:
parent
18306c74fb
commit
fecbceb610
2 changed files with 10 additions and 4 deletions
|
@ -109,6 +109,9 @@ packages are not included in your latex setup, they can be obtained from
|
|||
\--xetex
|
||||
: Use xelatex instead of pdflatex to create the PDF.
|
||||
|
||||
\--luatex
|
||||
: Use lualatex instead of pdflatex to create the PDF.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
`pandoc`(1), `pdflatex`(1)
|
||||
|
|
|
@ -194,7 +194,7 @@ main = bracket
|
|||
let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o","-V"]
|
||||
let goodoptslong = ["--from","--read","--strict",
|
||||
"--preserve-tabs","--tab-stop","--parse-raw",
|
||||
"--toc","--table-of-contents", "--xetex",
|
||||
"--toc","--table-of-contents", "--xetex", "--luatex",
|
||||
"--number-sections","--include-in-header",
|
||||
"--include-before-body","--include-after-body",
|
||||
"--custom-header","--output",
|
||||
|
@ -206,19 +206,22 @@ main = bracket
|
|||
-- note that a long option can come in this form: --opt=val
|
||||
let isGoodopt x = x `elem` (goodopts ++ goodoptslong) ||
|
||||
any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong
|
||||
let markdown2pdfOpts = ["--xetex","--luatex"]
|
||||
unless (all isGoodopt opts) $ do
|
||||
(code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""
|
||||
UTF8.putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"
|
||||
UTF8.putStr $ unlines $
|
||||
filter (\l -> any (`isInfixOf` l) goodoptslong) (lines out)
|
||||
++ [replicate 24 ' ' ++ "--xetex"]
|
||||
++ map (replicate 24 ' ' ++) markdown2pdfOpts
|
||||
exitWith code
|
||||
|
||||
let args' = filter (/= "--xetex") args
|
||||
let args' = filter (`notElem` markdown2pdfOpts) args
|
||||
|
||||
-- check for executable files
|
||||
let latexProgram = if "--xetex" `elem` opts
|
||||
then "xelatex"
|
||||
else if "--luatex" `elem` opts
|
||||
then "lualatex"
|
||||
else "pdflatex"
|
||||
let execs = ["pandoc", latexProgram, "bibtex"]
|
||||
paths <- mapM findExecutable execs
|
||||
|
|
Loading…
Reference in a new issue