From 2661658a696ebaab14b2792b7bbd38ef2b5904e4 Mon Sep 17 00:00:00 2001 From: Francesco Occhipinti Date: Wed, 1 Aug 2018 21:32:16 +0200 Subject: 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. --- src/Text/Pandoc/Writers/RST.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3