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" ++ vcat contents ++ "
\n"
+ return $ "\n" ++ vcat contents ++ "\n
\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
diff --git a/tests/tables.textile b/tests/tables.textile
index ccb34cf58..4836ecd79 100644
--- a/tests/tables.textile
+++ b/tests/tables.textile
@@ -1,16 +1,16 @@
Simple table with caption:
-
- Demonstration of simple table syntax.
-
+
+Demonstration of simple table syntax.
+
-
-
+
+
12 |
12 |
@@ -29,21 +29,21 @@ Simple table with caption:
1 |
1 |
-
-
+
+
Simple table without caption:
-
-
+
+
-
-
+
+
12 |
12 |
@@ -62,22 +62,22 @@ Simple table without caption:
1 |
1 |
-
-
+
+
Simple table indented two spaces:
-
- Demonstration of simple table syntax.
-
+
+Demonstration of simple table syntax.
+
-
-
+
+
12 |
12 |
@@ -96,26 +96,26 @@ Simple table indented two spaces:
1 |
1 |
-
-
+
+
Multiline table with caption:
-
- Here's the caption. It may span multiple lines.
-
-
-
-
-
+
+Here's the caption. It may span multiple lines.
+
+
+
+
+
-
-
+
+
First |
row |
@@ -128,25 +128,25 @@ Multiline table with caption:
5.0 |
Here's another one. Note the blank line between rows. |
-
-
+
+
Multiline table without caption:
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
First |
row |
@@ -159,13 +159,13 @@ Multiline table without caption:
5.0 |
Here's another one. Note the blank line between rows. |
-
-
+
+
Table without column headers:
-
-
+
+
12 |
12 |
@@ -184,17 +184,17 @@ Table without column headers:
1 |
1 |
-
-
+
+
Multiline table without column headers:
-
-
-
-
-
-
+
+
+
+
+
+
First |
row |
@@ -207,6 +207,6 @@ Multiline table without column headers:
5.0 |
Here's another one. Note the blank line between rows. |
-
-
+
+
diff --git a/tests/writer.textile b/tests/writer.textile
index f3513884a..a794a55a8 100644
--- a/tests/writer.textile
+++ b/tests/writer.textile
@@ -45,6 +45,8 @@ E-mail style:
bq. This is a block quote. It is pretty short.
+
+
Code in a block quote:
@@ -62,8 +64,10 @@ Nested block quotes:
bq. nested
+
bq. nested
+
This should not be a block quote: 2 > 1.
@@ -164,11 +168,12 @@ and using spaces:
Multiple paragraphs:
-
- -
Item 1, graf one.
- Item 1. graf two. The quick brown fox jumped over the lazy dog's back.
- -
Item 2.
- -
Item 3.
+
+Item 1, graf one.
+Item 1. graf two. The quick brown fox jumped over the lazy dog's back.
+Item 2.
+Item 3.
+
h2. Nested
@@ -203,32 +208,39 @@ h2. Tabs and spaces
h2. Fancy list markers
-
- - begins with 2
- -
and now 3
- with a continuation
-
- - sublist with roman numerals, starting with 4
- - more items
-
- - a subsublist
- - a subsublist
-
-
+
+- begins with 2
+and now 3
+with a continuation
+
+- sublist with roman numerals, starting with 4
+- more items
+
+- a subsublist
+- a subsublist
+
+
+
+
+
Nesting:
-
- - Upper Alpha
-
- - Upper Roman.
-
- - Decimal start with 6
-
- - Lower alpha with paren
-
-
-
+
+- Upper Alpha
+
+- Upper Roman.
+
+- Decimal start with 6
+
+- Lower alpha with paren
+
+
+
+
+
+
+
Autonumbering:
@@ -248,78 +260,88 @@ h1. Definition Lists
Tight using spaces:
-
- - apple
- - red fruit
- - orange
- - orange fruit
- - banana
- - yellow fruit
+
+- apple
+- red fruit
+- orange
+- orange fruit
+- banana
+- yellow fruit
+
Tight using tabs:
-
- - apple
- - red fruit
- - orange
- - orange fruit
- - banana
- - yellow fruit
+
+- apple
+- red fruit
+- orange
+- orange fruit
+- banana
+- yellow fruit
+
Loose:
-
- - apple
- -
red fruit
- - orange
- -
orange fruit
- - banana
- -
yellow fruit
+
+- apple
+red fruit
+- orange
+orange fruit
+- banana
+yellow fruit
+
Multiple blocks with italics:
-
- - _apple_
- -
red fruit
- contains seeds, crisp, pleasant to taste
- - _orange_
- -
orange fruit
+
+- _apple_
+red fruit
+contains seeds, crisp, pleasant to taste
+- _orange_
+orange fruit
bc. { orange code block }
-bq. orange block quote
+bq. orange block quote
+
+
+
Multiple definitions, tight:
-
- - apple
- - red fruit
- - computer
- - orange
- - orange fruit
- - bank
+
+- apple
+- red fruit
+- computer
+- orange
+- orange fruit
+- bank
+
Multiple definitions, loose:
-
- - apple
- -
red fruit
- -
computer
- - orange
- -
orange fruit
- -
bank
+
+- apple
+red fruit
+computer
+- orange
+orange fruit
+bank
+
Blank line after term, indented marker, alternate markers:
-
- - apple
- -
red fruit
- -
computer
- - orange
- -
orange fruit
-
- - sublist
- - sublist
-
+
+- apple
+red fruit
+computer
+- orange
+orange fruit
+
+- sublist
+- sublist
+
+
+
h1. HTML Blocks
@@ -630,6 +652,7 @@ An e-mail address: "nobody@nowhere.net":mailto:nobody@nowhere.net
bq. Blockquoted: "http://example.com/":http://example.com/
+
Auto-links should not occur here: @@
bc. or here:
@@ -653,6 +676,7 @@ Here is a footnote reference,[1] and another.[2] This should _not_ be a footnote
bq. Notes can go in quotes.[4]
+
# And in list items.[5]
This paragraph should not be part of the note, as it is not indented.