git.iko.soy/typeable/pandoc
on master help sign in
Added `--luatex` option to markdown2pdf.
fecbcebJohn MacFarlane
man/man1/markdown2pdf.1.md+3
@@ -109,6 +109,9 @@ packages are not included in your latex setup, they can be obtained from
109\--xetex
109\--xetex
110: Use xelatex instead of pdflatex to create the PDF.
110: Use xelatex instead of pdflatex to create the PDF.
111
111
112+\--luatex
113+: Use lualatex instead of pdflatex to create the PDF.
114+
112# SEE ALSO
115# SEE ALSO
113
116
114`pandoc`(1), `pdflatex`(1)
117`pandoc`(1), `pdflatex`(1)
src/markdown2pdf.hs+7−4
@@ -194,7 +194,7 @@ main = bracket
194 let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o","-V"]
194 let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o","-V"]
195 let goodoptslong = ["--from","--read","--strict",
195 let goodoptslong = ["--from","--read","--strict",
196 "--preserve-tabs","--tab-stop","--parse-raw",
196 "--preserve-tabs","--tab-stop","--parse-raw",
197− "--toc","--table-of-contents", "--xetex",
197+ "--toc","--table-of-contents", "--xetex", "--luatex",
198 "--number-sections","--include-in-header",
198 "--number-sections","--include-in-header",
199 "--include-before-body","--include-after-body",
199 "--include-before-body","--include-after-body",
200 "--custom-header","--output",
200 "--custom-header","--output",
@@ -206,20 +206,23 @@ main = bracket
206 -- note that a long option can come in this form: --opt=val
206 -- note that a long option can come in this form: --opt=val
207 let isGoodopt x = x `elem` (goodopts ++ goodoptslong) ||
207 let isGoodopt x = x `elem` (goodopts ++ goodoptslong) ||
208 any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong
208 any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong
209+ let markdown2pdfOpts = ["--xetex","--luatex"]
209 unless (all isGoodopt opts) $ do
210 unless (all isGoodopt opts) $ do
210 (code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""
211 (code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""
211 UTF8.putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"
212 UTF8.putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"
212 UTF8.putStr $ unlines $
213 UTF8.putStr $ unlines $
213 filter (\l -> any (`isInfixOf` l) goodoptslong) (lines out)
214 filter (\l -> any (`isInfixOf` l) goodoptslong) (lines out)
214− ++ [replicate 24 ' ' ++ "--xetex"]
215+ ++ map (replicate 24 ' ' ++) markdown2pdfOpts
215 exitWith code
216 exitWith code
216
217
217− let args' = filter (/= "--xetex") args
218+ let args' = filter (`notElem` markdown2pdfOpts) args
218
219
219 -- check for executable files
220 -- check for executable files
220 let latexProgram = if "--xetex" `elem` opts
221 let latexProgram = if "--xetex" `elem` opts
221 then "xelatex"
222 then "xelatex"
223+ else if "--luatex" `elem` opts
224+ then "lualatex"
222− else "pdflatex"
225+ else "pdflatex"
223 let execs = ["pandoc", latexProgram, "bibtex"]
226 let execs = ["pandoc", latexProgram, "bibtex"]
224 paths <- mapM findExecutable execs
227 paths <- mapM findExecutable execs
225 let miss = map snd $ filter (isNothing . fst) $ zip paths execs
228 let miss = map snd $ filter (isNothing . fst) $ zip paths execs