aboutsummaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs11
1 files changed, 9 insertions, 2 deletions
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)