aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorFrancesco Occhipinti <focchi.pinti@gmail.com>2018-08-01 21:32:16 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2018-08-01 12:32:16 -0700
commit2661658a696ebaab14b2792b7bbd38ef2b5904e4 (patch)
treec964cc0b8a4e4c441cb4648f89b1db7b198bcc59 /src/Text/Pandoc/Writers
parent08694efd89dccaebbb663d44bfa7787df3755545 (diff)
downloadpandoc-2661658a696ebaab14b2792b7bbd38ef2b5904e4.tar.gz
RST writer: use `titleblock` instead of `title` variable for title block
Closes #4803 After this commit use `$titleblock$` in order to get what was contained in `$title$` before, that is a title and subtitle rendered according to the official rST method: http://docutils.sourceforge.net/docs/user/rst/quickstart.html#document-title-subtitle. from With this commit, the `$title$` and `$subtitle$` metadata are available and they simply carry the metadata values. This opens up more possibilities in templates.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 817fb665d..0c118669b 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -83,13 +83,14 @@ pandocToRST (Pandoc meta blocks) = do
let render' :: Doc -> Text
render' = render colwidth
let subtit = case lookupMeta "subtitle" meta of
- Just (MetaBlocks [Plain xs]) -> xs
- _ -> []
+ Just (MetaBlocks [Plain xs]) -> xs
+ Just (MetaInlines xs) -> xs
+ _ -> []
title <- titleToRST (docTitle meta) subtit
metadata <- metaToJSON opts
(fmap render' . blockListToRST)
(fmap (stripEnd . render') . inlineListToRST)
- $ B.deleteMeta "title" $ B.deleteMeta "subtitle" meta
+ meta
body <- blockListToRST' True $ case writerTemplate opts of
Just _ -> normalizeHeadings 1 blocks
Nothing -> blocks
@@ -105,7 +106,7 @@ pandocToRST (Pandoc meta blocks) = do
$ defField "toc-depth" (show $ writerTOCDepth opts)
$ defField "number-sections" (writerNumberSections opts)
$ defField "math" hasMath
- $ defField "title" (render Nothing title :: String)
+ $ defField "titleblock" (render Nothing title :: String)
$ defField "math" hasMath
$ defField "rawtex" rawTeX metadata
case writerTemplate opts of