diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-07-22 22:49:38 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-07-22 22:49:38 -0700 |
commit | fd34dcba851ad1567b8969676174fc03a3afb958 (patch) | |
tree | cae6623f2a01f9398ffdc7dfd84248a2c459d67c /src/pandoc.hs | |
parent | 94405121abff5eb2ed8ddf7be5457a4dc6619d3b (diff) |
Changed default template naming scheme.
Instead of latex.template, we now have default.latex.
An appropriate extension is added automatically if the value of
`--template` has no extension. So, `pandoc --template=special -t latex`
looks for `special.latex`, while `pandoc --template=special -t man`
looks for `special.man`.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r-- | src/pandoc.hs | 11 |
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) |