@@ -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
217− let args' = filter (/= "--xetex") args
218+ let args' = filter (`notElem` markdown2pdfOpts) args
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
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