aboutsummaryrefslogtreecommitdiff
path: root/Text/Pandoc/Writers/RST.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-12-17 15:34:25 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-12-17 15:34:25 +0000
commit751aa15abcf945a40f4169a9e6a8640c36a801a5 (patch)
treec4e21bb021cbd1cd20bd43834621323b0ae7ad6b /Text/Pandoc/Writers/RST.hs
parent9ff729fc1e0855820215c0b2c07164705e2ce53f (diff)
downloadpandoc-751aa15abcf945a40f4169a9e6a8640c36a801a5.tar.gz
Fixed problems in RST and markdown output due to bug in pretty-1.0.1.0
+ Added hang' function to Text.Pandoc.Shared; this will be used instead of hang, which doesn't work properly in pretty-1.0.1.0. When pretty is upgraded, we can go back to hang. See http://article.gmane.org/gmane.comp.lang.haskell.general/16687 + Use hang' (and some different techniques) in RST and markdown writers. Some output is now a bit different. + Modify test suites accordingly. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1515 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text/Pandoc/Writers/RST.hs')
-rw-r--r--Text/Pandoc/Writers/RST.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Text/Pandoc/Writers/RST.hs b/Text/Pandoc/Writers/RST.hs
index 460a11852..91826cbcd 100644
--- a/Text/Pandoc/Writers/RST.hs
+++ b/Text/Pandoc/Writers/RST.hs
@@ -100,8 +100,8 @@ notesToRST notes =
noteToRST :: Int -> [Block] -> State WriterState Doc
noteToRST num note = do
contents <- blockListToRST note
- let marker = text ".. [" <> text (show num) <> text "] "
- return $ hang marker 3 contents
+ let marker = text ".. [" <> text (show num) <> text "]"
+ return $ marker $$ nest 3 contents
-- | Return RST representation of picture reference table.
pictTableToRST :: KeyTable -> State WriterState Doc
@@ -169,7 +169,7 @@ blockToRST (Para inlines) = do
return $ contents <> text "\n"
blockToRST (RawHtml str) =
let str' = if "\n" `isSuffixOf` str then str ++ "\n" else str ++ "\n\n" in
- return $ hang (text "\n.. raw:: html\n") 3 $ vcat $ map text (lines str')
+ return $ (text "\n.. raw:: html\n") $$ (nest 3 $ vcat $ map text (lines str'))
blockToRST HorizontalRule = return $ text "--------------\n"
blockToRST (Header level inlines) = do
contents <- inlineListToRST inlines
@@ -236,7 +236,7 @@ blockToRST (DefinitionList items) = do
bulletListItemToRST :: [Block] -> State WriterState Doc
bulletListItemToRST items = do
contents <- blockListToRST items
- return $ hang (text "- ") 3 contents
+ return $ (text "- ") <> contents
-- | Convert ordered list item (a list of blocks) to RST.
orderedListItemToRST :: String -- ^ marker for list item
@@ -244,7 +244,7 @@ orderedListItemToRST :: String -- ^ marker for list item
-> State WriterState Doc
orderedListItemToRST marker items = do
contents <- blockListToRST items
- return $ hang (text marker) (length marker + 1) contents
+ return $ (text marker <> char ' ') <> contents
-- | Convert defintion list item (label, list of blocks) to RST.
definitionListItemToRST :: ([Inline], [Block]) -> State WriterState Doc