git.iko.soy/typeable/pandoc
on master help sign in
Added `--luatex` option to markdown2pdf.

This uses lualatex to create the PDF.

commitfecbceb61025b5e9f5f2217aaf5d21ffdf3fde48 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 22 Jul 2011, 13:17 (15 years ago) parent18306c7
2 files changed+10−4
man/man1/markdown2pdf.1.md+3 src/markdown2pdf.hs+7−4
man/man1/markdown2pdf.1.md+3
@@ -109,6 +109,9 @@ packages are not included in your latex setup, they can be obtained from
109109\--xetex
110110: Use xelatex instead of pdflatex to create the PDF.
111111
112+\--luatex
113+: Use lualatex instead of pdflatex to create the PDF.
114+
112115# SEE ALSO
113116
114117`pandoc`(1), `pdflatex`(1)
src/markdown2pdf.hs+7−4
@@ -194,7 +194,7 @@ main = bracket
194194 let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o","-V"]
195195 let goodoptslong = ["--from","--read","--strict",
196196 "--preserve-tabs","--tab-stop","--parse-raw",
197− "--toc","--table-of-contents", "--xetex",
197+ "--toc","--table-of-contents", "--xetex", "--luatex",
198198 "--number-sections","--include-in-header",
199199 "--include-before-body","--include-after-body",
200200 "--custom-header","--output",
@@ -206,20 +206,23 @@ main = bracket
206206 -- note that a long option can come in this form: --opt=val
207207 let isGoodopt x = x `elem` (goodopts ++ goodoptslong) ||
208208 any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong
209+ let markdown2pdfOpts = ["--xetex","--luatex"]
209210 unless (all isGoodopt opts) $ do
210211 (code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""
211212 UTF8.putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"
212213 UTF8.putStr $ unlines $
213214 filter (\l -> any (`isInfixOf` l) goodoptslong) (lines out)
214− ++ [replicate 24 ' ' ++ "--xetex"]
215+ ++ map (replicate 24 ' ' ++) markdown2pdfOpts
215216 exitWith code
216217
217− let args' = filter (/= "--xetex") args
218+ let args' = filter (`notElem` markdown2pdfOpts) args
218219
219220 -- check for executable files
220221 let latexProgram = if "--xetex" `elem` opts
221222 then "xelatex"
222− else "pdflatex"
223+ else if "--luatex" `elem` opts
224+ then "lualatex"
225+ else "pdflatex"
223226 let execs = ["pandoc", latexProgram, "bibtex"]
224227 paths <- mapM findExecutable execs
225228 let miss = map snd $ filter (isNothing . fst) $ zip paths execs