From 751aa15abcf945a40f4169a9e6a8640c36a801a5 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Wed, 17 Dec 2008 15:34:25 +0000 Subject: 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 --- Text/Pandoc/Writers/RST.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Text/Pandoc/Writers/RST.hs') 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 -- cgit v1.2.3