diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-11-30 15:34:58 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-11-30 15:34:58 +0100 |
commit | fb8a2540bdb91eee0ecf620b4e9d7acf3d78042f (patch) | |
tree | 448a3c909200e8bbd45ecaa65f2f85d88bcc66c6 /src/Text/Pandoc/Writers/Markdown.hs | |
parent | ac312caabd8c4e595e0b930154fd3033ba397ace (diff) | |
download | pandoc-fb8a2540bdb91eee0ecf620b4e9d7acf3d78042f.tar.gz |
Options: Removed writerStandalone, made writerTemplate a Maybe.
Previously setting writerStandalone = True did nothing unless
a template was provided in writerTemplate. Now a fragment
will be generated if writerTemplate is Nothing; otherwise,
the specified template will be used and standalone output
generated. [API change]
Diffstat (limited to 'src/Text/Pandoc/Writers/Markdown.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 0e4ddc5b6..3a6ea77ac 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -184,17 +184,17 @@ pandocToMarkdown opts (Pandoc meta blocks) = do let title' = maybe empty text $ getField "title" metadata let authors' = maybe [] (map text) $ getField "author" metadata let date' = maybe empty text $ getField "date" metadata - let titleblock = case writerStandalone opts of - True | isPlain -> - plainTitleBlock title' authors' date' - | isEnabled Ext_yaml_metadata_block opts -> - yamlMetadataBlock metadata - | isEnabled Ext_pandoc_title_block opts -> - pandocTitleBlock title' authors' date' - | isEnabled Ext_mmd_title_block opts -> - mmdTitleBlock metadata - | otherwise -> empty - False -> empty + let titleblock = case writerTemplate opts of + Just _ | isPlain -> + plainTitleBlock title' authors' date' + | isEnabled Ext_yaml_metadata_block opts -> + yamlMetadataBlock metadata + | isEnabled Ext_pandoc_title_block opts -> + pandocTitleBlock title' authors' date' + | isEnabled Ext_mmd_title_block opts -> + mmdTitleBlock metadata + | otherwise -> empty + Nothing -> empty let headerBlocks = filter isHeaderBlock blocks let toc = if writerTableOfContents opts then tableOfContents opts headerBlocks @@ -216,9 +216,9 @@ pandocToMarkdown opts (Pandoc meta blocks) = do then id else defField "titleblock" (render' titleblock)) $ metadata - if writerStandalone opts - then return $ renderTemplate' (writerTemplate opts) context - else return main + case writerTemplate opts of + Nothing -> return main + Just tpl -> return $ renderTemplate' tpl context -- | Return markdown representation of reference key table. refsToMarkdown :: WriterOptions -> Refs -> MD Doc |