diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-04-27 20:56:50 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-04-27 20:56:50 -0700 |
commit | c8f97d3d418f929a1f499a9ef37c17d71f282d45 (patch) | |
tree | 3a0a6248965b1cbb8be91b8189ca2247454b8893 /pandoc.hs | |
parent | f80678df7f003c2e1c4f226fab39cea55f3907a8 (diff) | |
download | pandoc-c8f97d3d418f929a1f499a9ef37c17d71f282d45.tar.gz |
Fix #1267.
We now check the writerName for a lua script in pandoc.hs, so that
lowercasing and format parsing aren't done. Note this behavior
change: getWriter in Text.Pandoc no longer returns a custom writer on
input "foo.lua".
Diffstat (limited to 'pandoc.hs')
-rw-r--r-- | pandoc.hs | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -47,7 +47,7 @@ import System.Exit ( exitWith, ExitCode (..) ) import System.FilePath import System.Console.GetOpt import Data.Char ( toLower ) -import Data.List ( intercalate, isPrefixOf, sort ) +import Data.List ( intercalate, isPrefixOf, isSuffixOf, sort ) import System.Directory ( getAppUserDataDirectory, findExecutable, doesFileExist ) import System.IO ( stdout, stderr ) @@ -1021,15 +1021,18 @@ main = do let laTeXOutput = "latex" `isPrefixOf` writerName' || "beamer" `isPrefixOf` writerName' - writer <- case getWriter writerName' of - Left e -> err 9 $ - if writerName' == "pdf" - then e ++ "\nTo create a pdf with pandoc, use the " ++ - "latex or beamer writer and specify\n" ++ - "an output file with .pdf extension " ++ - "(pandoc -t latex -o filename.pdf)." - else e - Right w -> return w + writer <- if ".lua" `isSuffixOf` writerName' + -- note: use non-lowercased version writerName + then return $ IOStringWriter $ writeCustom writerName + else case getWriter writerName' of + Left e -> err 9 $ + if writerName' == "pdf" + then e ++ "\nTo create a pdf with pandoc, use " ++ + "the latex or beamer writer and specify\n" ++ + "an output file with .pdf extension " ++ + "(pandoc -t latex -o filename.pdf)." + else e + Right w -> return w reader <- case getReader readerName' of Right r -> return r |