From 65a015e74b326ca1bf88cf458629726a801d2fa3 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 23 Jan 2011 10:08:11 -0800 Subject: Added needed space after .bc and .bq. Otherwise these can trap a , for example. Better solution to try next: rewrite using Pretty. --- src/Text/Pandoc/Writers/Textile.hs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/Text/Pandoc/Writers/Textile.hs') diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs index 0987e1314..cab582fc3 100644 --- a/src/Text/Pandoc/Writers/Textile.hs +++ b/src/Text/Pandoc/Writers/Textile.hs @@ -106,7 +106,7 @@ blockToTextile opts (Para inlines) = do listLevel <- liftM stListLevel get contents <- inlineListToTextile opts inlines return $ if useTags - then "

" ++ contents ++ "

" + then "

" ++ contents ++ "

" else contents ++ if null listLevel then "\n" else "" blockToTextile _ (RawHtml str) = return str @@ -126,14 +126,14 @@ blockToTextile _ (CodeBlock (_,classes,_) str) | any (all isSpace) (lines str) = else " class=\"" ++ unwords classes ++ "\"" blockToTextile _ (CodeBlock (_,classes,_) str) = - return $ "bc" ++ classes' ++ ". " ++ str ++ "\n" + return $ "bc" ++ classes' ++ ". " ++ str ++ "\n\n" where classes' = if null classes then "" else "(" ++ unwords classes ++ ")" blockToTextile opts (BlockQuote bs@[Para _]) = do contents <- blockListToTextile opts bs - return $ "bq. " ++ contents + return $ "bq. " ++ contents ++ "\n\n" blockToTextile opts (BlockQuote blocks) = do contents <- blockListToTextile opts blocks @@ -155,20 +155,20 @@ blockToTextile opts (Table capt aligns widths headers rows') = do then return "" else do c <- inlineListToTextile opts capt - return $ " " ++ c ++ "\n" + return $ "" ++ c ++ "\n" let percent w = show (truncate (100*w) :: Integer) ++ "%" let coltags = if all (== 0.0) widths then "" else unlines $ map - (\w -> " ") widths + (\w -> "") widths head' <- if all null headers then return "" else do hs <- tableRowToTextile opts alignStrings 0 headers - return $ " \n" ++ hs ++ "\n \n" + return $ "\n" ++ hs ++ "\n\n" body' <- zipWithM (tableRowToTextile opts alignStrings) [1..] rows' - return $ " \n" ++ captionDoc ++ coltags ++ head' ++ - " \n" ++ unlines body' ++ " \n
\n" + return $ "\n" ++ captionDoc ++ coltags ++ head' ++ + "\n" ++ unlines body' ++ "\n
\n" blockToTextile opts x@(BulletList items) = do oldUseTags <- liftM stUseTags get @@ -176,7 +176,7 @@ blockToTextile opts x@(BulletList items) = do if useTags then do contents <- withUseTags $ mapM (listItemToTextile opts) items - return $ " \n" + return $ "\n" else do modify $ \s -> s { stListLevel = stListLevel s ++ "*" } level <- get >>= return . length . stListLevel @@ -190,8 +190,8 @@ blockToTextile opts x@(OrderedList attribs items) = do if useTags then do contents <- withUseTags $ mapM (listItemToTextile opts) items - return $ " \n" ++ vcat contents ++ - " \n" + return $ "\n" ++ vcat contents ++ + "\n\n" else do modify $ \s -> s { stListLevel = stListLevel s ++ "#" } level <- get >>= return . length . stListLevel @@ -201,7 +201,7 @@ blockToTextile opts x@(OrderedList attribs items) = do blockToTextile opts (DefinitionList items) = do contents <- withUseTags $ mapM (definitionListItemToTextile opts) items - return $ "
\n" ++ vcat contents ++ "
\n" + return $ "
\n" ++ vcat contents ++ "\n
\n" -- Auxiliary functions for lists: @@ -222,7 +222,7 @@ listItemToTextile opts items = do contents <- blockListToTextile opts items useTags <- get >>= return . stUseTags if useTags - then return $ "
  • " ++ contents ++ "
  • " + then return $ "
  • " ++ contents ++ "
  • " else do marker <- get >>= return . stListLevel return $ marker ++ " " ++ contents @@ -234,8 +234,8 @@ definitionListItemToTextile :: WriterOptions definitionListItemToTextile opts (label, items) = do labelText <- inlineListToTextile opts label contents <- mapM (blockListToTextile opts) items - return $ "
    " ++ labelText ++ "
    \n" ++ - (intercalate "\n" $ map (\d -> "
    " ++ d ++ "
    ") contents) + return $ "
    " ++ labelText ++ "
    \n" ++ + (intercalate "\n" $ map (\d -> "
    " ++ d ++ "
    ") contents) -- | True if the list can be handled by simple wiki markup, False if HTML tags will be needed. isSimpleList :: Block -> Bool -- cgit v1.2.3