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
|
\--xetex
|
||||||
: Use xelatex instead of pdflatex to create the PDF.
|
: Use xelatex instead of pdflatex to create the PDF.
|
||||||
|
|
||||||
|
\--luatex
|
||||||
|
: Use lualatex instead of pdflatex to create the PDF.
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
`pandoc`(1), `pdflatex`(1)
|
`pandoc`(1), `pdflatex`(1)
|
||||||
|
|
|
@ -194,7 +194,7 @@ main = bracket
|
||||||
let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o","-V"]
|
let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o","-V"]
|
||||||
let goodoptslong = ["--from","--read","--strict",
|
let goodoptslong = ["--from","--read","--strict",
|
||||||
"--preserve-tabs","--tab-stop","--parse-raw",
|
"--preserve-tabs","--tab-stop","--parse-raw",
|
||||||
"--toc","--table-of-contents", "--xetex",
|
"--toc","--table-of-contents", "--xetex", "--luatex",
|
||||||
"--number-sections","--include-in-header",
|
"--number-sections","--include-in-header",
|
||||||
"--include-before-body","--include-after-body",
|
"--include-before-body","--include-after-body",
|
||||||
"--custom-header","--output",
|
"--custom-header","--output",
|
||||||
|
@ -206,20 +206,23 @@ main = bracket
|
||||||
-- note that a long option can come in this form: --opt=val
|
-- note that a long option can come in this form: --opt=val
|
||||||
let isGoodopt x = x `elem` (goodopts ++ goodoptslong) ||
|
let isGoodopt x = x `elem` (goodopts ++ goodoptslong) ||
|
||||||
any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong
|
any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong
|
||||||
|
let markdown2pdfOpts = ["--xetex","--luatex"]
|
||||||
unless (all isGoodopt opts) $ do
|
unless (all isGoodopt opts) $ do
|
||||||
(code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""
|
(code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""
|
||||||
UTF8.putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"
|
UTF8.putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"
|
||||||
UTF8.putStr $ unlines $
|
UTF8.putStr $ unlines $
|
||||||
filter (\l -> any (`isInfixOf` l) goodoptslong) (lines out)
|
filter (\l -> any (`isInfixOf` l) goodoptslong) (lines out)
|
||||||
++ [replicate 24 ' ' ++ "--xetex"]
|
++ map (replicate 24 ' ' ++) markdown2pdfOpts
|
||||||
exitWith code
|
exitWith code
|
||||||
|
|
||||||
let args' = filter (/= "--xetex") args
|
let args' = filter (`notElem` markdown2pdfOpts) args
|
||||||
|
|
||||||
-- check for executable files
|
-- check for executable files
|
||||||
let latexProgram = if "--xetex" `elem` opts
|
let latexProgram = if "--xetex" `elem` opts
|
||||||
then "xelatex"
|
then "xelatex"
|
||||||
else "pdflatex"
|
else if "--luatex" `elem` opts
|
||||||
|
then "lualatex"
|
||||||
|
else "pdflatex"
|
||||||
let execs = ["pandoc", latexProgram, "bibtex"]
|
let execs = ["pandoc", latexProgram, "bibtex"]
|
||||||
paths <- mapM findExecutable execs
|
paths <- mapM findExecutable execs
|
||||||
let miss = map snd $ filter (isNothing . fst) $ zip paths execs
|
let miss = map snd $ filter (isNothing . fst) $ zip paths execs
|
||||||
|
|
Loading…
Reference in a new issue