@@ -184,17 +184,17 @@ pandocToMarkdown opts (Pandoc meta blocks) = do
184184 let title' = maybe empty text $ getField "title" metadata
185185 let authors' = maybe [] (map text) $ getField "author" metadata
186186 let date' = maybe empty text $ getField "date" metadata
187− let titleblock = case writerStandalone opts of
188− True | isPlain ->
189− plainTitleBlock title' authors' date'
190− | isEnabled Ext_yaml_metadata_block opts ->
191− yamlMetadataBlock metadata
192− | isEnabled Ext_pandoc_title_block opts ->
193− pandocTitleBlock title' authors' date'
194− | isEnabled Ext_mmd_title_block opts ->
195− mmdTitleBlock metadata
196− | otherwise -> empty
197− False -> empty
187+ let titleblock = case writerTemplate opts of
188+ Just _ | isPlain ->
189+ plainTitleBlock title' authors' date'
190+ | isEnabled Ext_yaml_metadata_block opts ->
191+ yamlMetadataBlock metadata
192+ | isEnabled Ext_pandoc_title_block opts ->
193+ pandocTitleBlock title' authors' date'
194+ | isEnabled Ext_mmd_title_block opts ->
195+ mmdTitleBlock metadata
196+ | otherwise -> empty
197+ Nothing -> empty
198198 let headerBlocks = filter isHeaderBlock blocks
199199 let toc = if writerTableOfContents opts
200200 then tableOfContents opts headerBlocks
@@ -216,9 +216,9 @@ pandocToMarkdown opts (Pandoc meta blocks) = do
216216 then id
217217 else defField "titleblock" (render' titleblock))
218218 $ metadata
219− if writerStandalone opts
220− then return $ renderTemplate' (writerTemplate opts) context
221− else return main
219+ case writerTemplate opts of
220+ Nothing -> return main
221+ Just tpl -> return $ renderTemplate' tpl context
222222
223223-- | Return markdown representation of reference key table.
224224refsToMarkdown :: WriterOptions -> Refs -> MD Doc