diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Templates.hs | 2 | ||||
-rw-r--r-- | src/pandoc.hs | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs index cad89f35f..8b966ca7a 100644 --- a/src/Text/Pandoc/Templates.hs +++ b/src/Text/Pandoc/Templates.hs @@ -85,7 +85,7 @@ getDefaultTemplate _ "native" = return $ Right "" getDefaultTemplate user "odt" = getDefaultTemplate user "opendocument" getDefaultTemplate user writer = do let format = takeWhile (/='+') writer -- strip off "+lhs" if present - let fname = "templates" </> format <.> "template" + let fname = "templates" </> "default" <.> format E.try $ readDataFile user fname data TemplateState = TemplateState Int [(String,String)] diff --git a/src/pandoc.hs b/src/pandoc.hs index 5900574ce..22afd77ea 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -738,10 +738,17 @@ main = do case deftemp of Left e -> throwIO e Right t -> return t - Just tp -> catch (UTF8.readFile tp) + Just tp -> do + -- strip off "+lhs" if present + let format = takeWhile (/='+') writerName' + let tp' = case takeExtension tp of + "" -> tp <.> format + _ -> tp + catch (UTF8.readFile tp') (\e -> if isDoesNotExistError e then catch - (readDataFile datadir tp) + (readDataFile datadir $ + "templates" </> tp') (\_ -> throwIO e) else throwIO e) |