@@ -34,7 +34,7 @@ run file opts = do
34parsePandocArgs :: [String] -> IO (Maybe ([String], String))
34parsePandocArgs :: [String] -> IO (Maybe ([String], String))
35parsePandocArgs args = do
35parsePandocArgs args = do
36 result <- run "pandoc" $ ["--dump-args"] ++ args
36 result <- run "pandoc" $ ["--dump-args"] ++ args
37− return $ either (const Nothing) (parse . map trim . lines) result
37+ return $ either error (parse . map trim . lines) result
38 where parse [] = Nothing
38 where parse [] = Nothing
39 parse ("-":[]) = Just ([], "stdin") -- no output or input
39 parse ("-":[]) = Just ([], "stdin") -- no output or input
40 parse ("-":x:xs) = Just (x:xs, dropExtension x) -- no output
40 parse ("-":x:xs) = Just (x:xs, dropExtension x) -- no output
@@ -43,11 +43,11 @@ parsePandocArgs args = do
43 trim = takeWhile (/='\r') . dropWhile (=='\r')
43 trim = takeWhile (/='\r') . dropWhile (=='\r')
45runPandoc :: [String] -> FilePath -> IO (Either String FilePath)
45runPandoc :: [String] -> FilePath -> IO (Either String FilePath)
46−runPandoc inputs output = do
46+runPandoc inputsAndArgs output = do
47 let texFile = replaceExtension output "tex"
47 let texFile = replaceExtension output "tex"
48 result <- run "pandoc" $
48 result <- run "pandoc" $
49 ["-s", "--no-wrap", "-r", "markdown", "-w", "latex"]
49 ["-s", "--no-wrap", "-r", "markdown", "-w", "latex"]
50− ++ inputs ++ ["-o", texFile]
50+ ++ inputsAndArgs ++ ["-o", texFile]
51 return $ either Left (const $ Right texFile) result
51 return $ either Left (const $ Right texFile) result
53runLatexRaw :: String -> FilePath -> IO (Either (Either String String) FilePath)
53runLatexRaw :: String -> FilePath -> IO (Either (Either String String) FilePath)