From 3cac33bdd2b2b69ac585cc37498deea49763c665 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 11 Oct 2022 18:01:41 +0200 Subject: 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 --- src/Text/Pandoc/App/OutputSettings.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3