@@ -130,7 +130,10 @@ metaToRST opts (Meta title authors date) = do
130 title' <- titleToRST opts title
130 title' <- titleToRST opts title
131 authors' <- authorsToRST authors
131 authors' <- authorsToRST authors
132 date' <- dateToRST date
132 date' <- dateToRST date
133+ let toc = if writerTableOfContents opts
134+ then text "" $$ text ".. contents::"
133− return $ title' <> authors' <> date'
136+ return $ title' $$ authors' $$ date' $$ toc $$ text ""
135titleToRST :: WriterOptions -> [Inline] -> State WriterState Doc
138titleToRST :: WriterOptions -> [Inline] -> State WriterState Doc
136titleToRST opts [] = return empty
139titleToRST opts [] = return empty
@@ -138,17 +141,17 @@ titleToRST opts lst = do
138 contents <- inlineListToRST opts lst
141 contents <- inlineListToRST opts lst
139 let titleLength = length $ render contents
142 let titleLength = length $ render contents
140 let border = text (replicate titleLength '=')
143 let border = text (replicate titleLength '=')
141− return $ border <> char '\n' <> contents <> char '\n' <> border <> text "\n\n"
144+ return $ border <> char '\n' <> contents <> char '\n' <> border <> text "\n"
143authorsToRST :: [String] -> State WriterState Doc
146authorsToRST :: [String] -> State WriterState Doc
144authorsToRST [] = return empty
147authorsToRST [] = return empty
145authorsToRST (first:rest) = do
148authorsToRST (first:rest) = do
146 rest' <- authorsToRST rest
149 rest' <- authorsToRST rest
147− return $ text ":Author: " <> text first <> char '\n' <> rest'
150+ return $ (text ":Author: " <> text first) $$ rest'
149dateToRST :: String -> State WriterState Doc
152dateToRST :: String -> State WriterState Doc
150dateToRST [] = return empty
153dateToRST [] = return empty
151−dateToRST str = return $ text ":Date: " <> text (escapeString str) <> char '\n'
154+dateToRST str = return $ text ":Date: " <> text (escapeString str)
153-- | Convert Pandoc block element to RST.
156-- | Convert Pandoc block element to RST.
154blockToRST :: WriterOptions -- ^ Options
157blockToRST :: WriterOptions -- ^ Options