Fix regression finding templates in user data directory.

Under version 2.2.1 and prior pandoc found latex templates in the
templates directory under the data directory, but this no longer
works in 2.2.2.

MANUAL says: "If the template is not found, pandoc will search for it in
the templates subdirectory of the user data directory (see `--data-dir`)."

This commit fixes the regression, which stems from 07bce91.

Closes #4777.
This commit is contained in:
John MacFarlane
2018-07-18 18:55:12 -07:00
parent e1eeb663fc
commit d7edfbdf4d
+1 -3
View File
@@ -83,7 +83,6 @@ import System.Exit (exitSuccess)
import System.FilePath
import System.IO (nativeNewline, stdout)
import qualified System.IO as IO (Newline (..))
import System.IO.Error (isDoesNotExistError)
import Text.Pandoc
import Text.Pandoc.BCP47 (Lang (..), parseBCP47)
import Text.Pandoc.Builder (setMeta, deleteMeta)
@@ -383,8 +382,7 @@ convertWithOpts opts = do
((fst <$> fetchItem tp') `catchError`
(\e ->
case e of
PandocIOError _ e' |
isDoesNotExistError e' ->
PandocResourceNotFound _ ->
readDataFile ("templates" </> tp')
_ -> throwError e))