diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs index cb8f20a0a..4aaee0a32 100644 --- a/src/Text/Pandoc/Writers/Textile.hs +++ b/src/Text/Pandoc/Writers/Textile.hs @@ -118,15 +118,18 @@ blockToTextile opts (Header level inlines) = do let prefix = 'h' : (show level ++ ". ") return $ prefix ++ contents ++ "\n" +blockToTextile _ (CodeBlock (_,classes,_) str) | any (all isSpace) (lines str) = + return $ "\n" ++ escapeStringForXML str ++ + "\n\n" + where classes' = if null classes + then "" + else " class=\"" ++ unwords classes ++ "\"" + blockToTextile _ (CodeBlock (_,classes,_) str) = - return $ "bc" ++ classes' ++ dots ++ escapeStringForXML str ++ "\n" + return $ "bc" ++ classes' ++ ". " ++ escapeStringForXML str ++ "\n" where classes' = if null classes then "" else "(" ++ unwords classes ++ ")" - dots = if any isBlank (lines str) - then ".. " - else ". " - isBlank = all isSpace blockToTextile opts (BlockQuote bs@[Para _]) = do contents <- blockListToTextile opts bs diff --git a/tests/writer.textile b/tests/writer.textile index f0ff383f0..ee67a7f33 100644 --- a/tests/writer.textile +++ b/tests/writer.textile @@ -76,19 +76,23 @@ h1. Code Blocks Code: -bc.. ---- (should be four hyphens) +
+---- (should be four hyphens)
 
 sub status {
     print "working";
 }
 
 this code block is indented by one tab
+
And: -bc.. this code block is indented by two tabs +
+    this code block is indented by two tabs
 
 These should not be escaped:  \$ \\ \> \[ \{
+