git.iko.soy/typeable/pandoc
on master help sign in
When checking reader/writer name, check base name...
98bedd7John MacFarlane
src/Text/Pandoc/App.hs+11−9
@@ -131,9 +131,10 @@ convertWithOpts opts = do
131 (map (T.pack . takeExtension) sources) "markdown"
131 (map (T.pack . takeExtension) sources) "markdown"
132 return "markdown"
132 return "markdown"
133
133
134+ let readerNameBase = T.takeWhile (\c -> c /= '+' && c /= '-') readerName
134 let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
135 let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
135
136
136− when (pdfOutput && readerName == "latex") $
137+ when (pdfOutput && readerNameBase == "latex") $
137 case optInputFiles opts of
138 case optInputFiles opts of
138 Just (inputFile:_) -> report $ UnusualConversion $ T.pack $
139 Just (inputFile:_) -> report $ UnusualConversion $ T.pack $
139 "to convert a .tex file to PDF, you get better results by using pdflatex "
140 "to convert a .tex file to PDF, you get better results by using pdflatex "
@@ -144,8 +145,8 @@ convertWithOpts opts = do
144 (reader :: Reader PandocIO, readerExts) <- getReader readerName
145 (reader :: Reader PandocIO, readerExts) <- getReader readerName
145
146
146 let convertTabs = tabFilter (if optPreserveTabs opts ||
147 let convertTabs = tabFilter (if optPreserveTabs opts ||
147− readerName == "t2t" ||
148+ readerNameBase == "t2t" ||
148− readerName == "man"
149+ readerNameBase == "man"
149 then 0
150 then 0
150 else optTabStop opts)
151 else optTabStop opts)
151
152
@@ -159,11 +160,12 @@ convertWithOpts opts = do
159 let format = outputFormat outputSettings
160 let format = outputFormat outputSettings
160 let writer = outputWriter outputSettings
161 let writer = outputWriter outputSettings
161 let writerName = outputWriterName outputSettings
162 let writerName = outputWriterName outputSettings
163+ let writerNameBase = T.takeWhile (\c -> c /= '+' && c /= '-') writerName
162 let writerOptions = outputWriterOptions outputSettings
164 let writerOptions = outputWriterOptions outputSettings
163
165
164− let bibOutput = writerName == "bibtex" ||
166+ let bibOutput = writerNameBase == "bibtex" ||
165− writerName == "biblatex" ||
167+ writerNameBase == "biblatex" ||
166− writerName == "csljson"
168+ writerNameBase == "csljson"
167
169
168 let standalone = optStandalone opts ||
170 let standalone = optStandalone opts ||
169 not (isTextFormat format) ||
171 not (isTextFormat format) ||
@@ -255,7 +257,7 @@ convertWithOpts opts = do
255 sourceToDoc sources' =
257 sourceToDoc sources' =
256 case reader of
258 case reader of
257 TextReader r
259 TextReader r
258− | optFileScope opts || readerName == "json" ->
260+ | optFileScope opts || readerNameBase == "json" ->
259 mconcat <$> mapM (readSource >=> r readerOpts) sources'
261 mconcat <$> mapM (readSource >=> r readerOpts) sources'
260 | otherwise ->
262 | otherwise ->
261 readSources sources' >>= r readerOpts
263 readSources sources' >>= r readerOpts
@@ -263,8 +265,8 @@ convertWithOpts opts = do
263 mconcat <$> mapM (readFile' >=> r readerOpts) sources'
265 mconcat <$> mapM (readFile' >=> r readerOpts) sources'
264
266
265
267
266− when (readerName == "markdown_github" ||
268+ when (readerNameBase == "markdown_github" ||
267− writerName == "markdown_github") $
269+ writerNameBase == "markdown_github") $
268 report $ Deprecated "markdown_github" "Use gfm instead."
270 report $ Deprecated "markdown_github" "Use gfm instead."
269
271
270 mapM_ (uncurry setRequestHeader) (optRequestHeaders opts)
272 mapM_ (uncurry setRequestHeader) (optRequestHeaders opts)