Give better error messages when someone tries to convert pdf, doc, odt.
Closes #1683.
This commit is contained in:
parent
d7169c715d
commit
6eda32871f
1 changed files with 12 additions and 1 deletions
13
pandoc.hs
13
pandoc.hs
|
@ -930,6 +930,9 @@ defaultReaderName fallback (x:xs) =
|
||||||
".docx" -> "docx"
|
".docx" -> "docx"
|
||||||
".t2t" -> "t2t"
|
".t2t" -> "t2t"
|
||||||
".epub" -> "epub"
|
".epub" -> "epub"
|
||||||
|
".odt" -> "odt" -- so we get an "unknown reader" error
|
||||||
|
".pdf" -> "pdf" -- so we get an "unknown reader" error
|
||||||
|
".doc" -> "doc" -- so we get an "unknown reader" error
|
||||||
_ -> defaultReaderName fallback xs
|
_ -> defaultReaderName fallback xs
|
||||||
|
|
||||||
-- Returns True if extension of first source is .lhs
|
-- Returns True if extension of first source is .lhs
|
||||||
|
@ -1148,7 +1151,15 @@ main = do
|
||||||
(getT2TMeta sources outputFile)
|
(getT2TMeta sources outputFile)
|
||||||
else case getReader readerName' of
|
else case getReader readerName' of
|
||||||
Right r -> return r
|
Right r -> return r
|
||||||
Left e -> err 7 e
|
Left e -> err 7 e'
|
||||||
|
where e' = case readerName' of
|
||||||
|
"odt" -> e ++
|
||||||
|
"\nPandoc can convert to ODT, but not from ODT.\nTry using LibreOffice to export as HTML, and convert that with pandoc."
|
||||||
|
"pdf" -> e ++
|
||||||
|
"\nPandoc can convert to PDF, but not from PDF."
|
||||||
|
"doc" -> e ++
|
||||||
|
"\nPandoc can convert from DOCX, but not from DOC.\nTry using Word to save your DOC file as DOCX, and convert that with pandoc."
|
||||||
|
_ -> e
|
||||||
|
|
||||||
let standalone' = standalone || not (isTextFormat writerName') || pdfOutput
|
let standalone' = standalone || not (isTextFormat writerName') || pdfOutput
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue