Fix fallback to default partials on templates.
If the directory containing a template does not contain the partial, it should be sought in the default data files. Closes #7164.
This commit is contained in:
parent
dc94601eb5
commit
eacead3eb3
1 changed files with 4 additions and 0 deletions
|
@ -34,6 +34,7 @@ import Control.Monad.Except (catchError, throwError)
|
|||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Text.Pandoc.Error
|
||||
import System.IO.Error (isDoesNotExistError)
|
||||
|
||||
-- | Wrap a Monad in this if you want partials to
|
||||
-- be taken only from the default data files.
|
||||
|
@ -70,6 +71,9 @@ getTemplate tp = UTF8.toText <$>
|
|||
PandocResourceNotFound _ ->
|
||||
-- see #5987 on reason for takeFileName
|
||||
readDataFile ("templates" </> takeFileName tp)
|
||||
PandocIOError _ ioe | isDoesNotExistError ioe ->
|
||||
-- see #5987 on reason for takeFileName
|
||||
readDataFile ("templates" </> takeFileName tp)
|
||||
_ -> throwError e))
|
||||
|
||||
-- | Get default template for the specified writer.
|
||||
|
|
Loading…
Add table
Reference in a new issue