aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-10-11 18:01:41 +0200
committerAlbert Krewinkel <[email protected]>2022-10-11 18:19:31 +0200
commit3cac33bdd2b2b69ac585cc37498deea49763c665 (patch)
tree1fdf7e1808e325b07d566505afd001e4a50b6cb2
parent4a97f5799a4bf9b672202fbd95cdef6cc49f62f8 (diff)
Templates: use filename to search for default template of custom writers
The default template of a custom writer `/path/to/my-writer.lua` is expected in the `templates/default.my-writer.lua` data file. Note that templates are *not* applied automatically to the output of custom writers; custom writer authors must ensure that the template is applied if one is present in the writer options. Closes: #8137
-rw-r--r--src/Text/Pandoc/App/OutputSettings.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
index ab224cd7f..537def363 100644
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -188,7 +188,9 @@ optToOutputSettings scriptingEngine opts = do
templ <- case optTemplate opts of
_ | not standalone -> return Nothing
- Nothing -> Just <$> compileDefaultTemplate format
+ Nothing ->
+ let filename = T.pack . takeFileName . T.unpack
+ in Just <$> compileDefaultTemplate (filename format)
Just tp -> do
-- strip off extensions
let tp' = case takeExtension tp of