@@ -59,12 +59,14 @@ pandocToRST :: Pandoc -> State WriterState Doc
59pandocToRST (Pandoc meta blocks) = do
59pandocToRST (Pandoc meta blocks) = do
60 opts <- get >>= (return . stOptions)
60 opts <- get >>= (return . stOptions)
61 let before = writerIncludeBefore opts
61 let before = writerIncludeBefore opts
62− let after = writerIncludeAfter opts
62+ after = writerIncludeAfter opts
63+ header = writerHeader opts
63 before' = if null before then empty else text before
64 before' = if null before then empty else text before
64 after' = if null after then empty else text after
65 after' = if null after then empty else text after
66+ header' = if null header then empty else text header
65 metaBlock <- metaToRST opts meta
67 metaBlock <- metaToRST opts meta
66 let head' = if (writerStandalone opts)
68 let head' = if (writerStandalone opts)
67− then metaBlock $+$ text (writerHeader opts)
69+ then metaBlock $+$ header'
68 else empty
70 else empty
69 body <- blockListToRST blocks
71 body <- blockListToRST blocks
70 includes <- get >>= (return . concat . stIncludes)
72 includes <- get >>= (return . concat . stIncludes)
@@ -129,6 +131,7 @@ escapeString = escapeStringUsing (backslashEscapes "`\\|*_")
130-- | Convert bibliographic information into RST header.
132-- | Convert bibliographic information into RST header.
131metaToRST :: WriterOptions -> Meta -> State WriterState Doc
133metaToRST :: WriterOptions -> Meta -> State WriterState Doc
134+metaToRST _ (Meta [] [] []) = return empty
132metaToRST opts (Meta title authors date) = do
135metaToRST opts (Meta title authors date) = do
133 title' <- titleToRST title
136 title' <- titleToRST title
134 authors' <- authorsToRST authors
137 authors' <- authorsToRST authors
@@ -136,7 +139,7 @@ metaToRST opts (Meta title authors date) = do
136 let toc = if writerTableOfContents opts
139 let toc = if writerTableOfContents opts
137 then text "" $+$ text ".. contents::"
140 then text "" $+$ text ".. contents::"
138 else empty
141 else empty
139− return $ title' $+$ authors' $+$ date' $+$ toc
142+ return $ title' $+$ authors' $+$ date' $+$ toc $+$ text ""
141titleToRST :: [Inline] -> State WriterState Doc
144titleToRST :: [Inline] -> State WriterState Doc
142titleToRST [] = return empty
145titleToRST [] = return empty