diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-02-07 19:20:35 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-02-07 19:20:35 +0000 |
commit | dcedb2f71243197f34c241b28b8ae76c2f1422c6 (patch) | |
tree | 02d2a4f2cb871e959bee09adc85ea201efa409c4 /src/Text/Pandoc/Writers/RST.hs | |
parent | a03331a3b45946a20fcb7181ea9cb29b5fb088a8 (diff) | |
download | pandoc-dcedb2f71243197f34c241b28b8ae76c2f1422c6.tar.gz |
Fixed bug with header spacing in Markdown and RST writers.
A null header (Meta [] [] []) should not cause a blank line
at the beginning of output. But a blank line is needed between
a non-null header and the main text.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1536 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers/RST.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/RST.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 91826cbcd..728c78712 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -59,12 +59,14 @@ pandocToRST :: Pandoc -> State WriterState Doc pandocToRST (Pandoc meta blocks) = do opts <- get >>= (return . stOptions) let before = writerIncludeBefore opts - let after = writerIncludeAfter opts + after = writerIncludeAfter opts + header = writerHeader opts before' = if null before then empty else text before after' = if null after then empty else text after + header' = if null header then empty else text header metaBlock <- metaToRST opts meta let head' = if (writerStandalone opts) - then metaBlock $+$ text (writerHeader opts) + then metaBlock $+$ header' else empty body <- blockListToRST blocks includes <- get >>= (return . concat . stIncludes) @@ -129,6 +131,7 @@ escapeString = escapeStringUsing (backslashEscapes "`\\|*_") -- | Convert bibliographic information into RST header. metaToRST :: WriterOptions -> Meta -> State WriterState Doc +metaToRST _ (Meta [] [] []) = return empty metaToRST opts (Meta title authors date) = do title' <- titleToRST title authors' <- authorsToRST authors @@ -136,7 +139,7 @@ metaToRST opts (Meta title authors date) = do let toc = if writerTableOfContents opts then text "" $+$ text ".. contents::" else empty - return $ title' $+$ authors' $+$ date' $+$ toc + return $ title' $+$ authors' $+$ date' $+$ toc $+$ text "" titleToRST :: [Inline] -> State WriterState Doc titleToRST [] = return empty |