git.iko.soy/typeable/pandoc
on master help sign in
Textile writer: Use <pre> instead of bc.. for code with blank lines.

This has fewer interaction effects.

commit7234a79104ab8cf8358bdab153d5eefbcefc2e9a authorJohn MacFarlane <jgm@berkeley.edu> dateSun 23 Jan 2011, 08:49 (16 years ago) parent1d683be
2 files changed+14−7
src/Text/Pandoc/Writers/Textile.hs+8−5 tests/writer.textile+6−2
src/Text/Pandoc/Writers/Textile.hs+8−5
@@ -118,15 +118,18 @@ blockToTextile opts (Header level inlines) = do
118118 let prefix = 'h' : (show level ++ ". ")
119119 return $ prefix ++ contents ++ "\n"
120120
121+blockToTextile _ (CodeBlock (_,classes,_) str) | any (all isSpace) (lines str) =
122+ return $ "<pre" ++ classes' ++ ">\n" ++ escapeStringForXML str ++
123+ "\n</pre>\n"
124+ where classes' = if null classes
125+ then ""
126+ else " class=\"" ++ unwords classes ++ "\""
127+
121128blockToTextile _ (CodeBlock (_,classes,_) str) =
122− return $ "bc" ++ classes' ++ dots ++ escapeStringForXML str ++ "\n"
129+ return $ "bc" ++ classes' ++ ". " ++ escapeStringForXML str ++ "\n"
123130 where classes' = if null classes
124131 then ""
125132 else "(" ++ unwords classes ++ ")"
126− dots = if any isBlank (lines str)
127− then ".. "
128− else ". "
129− isBlank = all isSpace
130133
131134blockToTextile opts (BlockQuote bs@[Para _]) = do
132135 contents <- blockListToTextile opts bs
tests/writer.textile+6−2
@@ -76,19 +76,23 @@ h1. Code Blocks
7676
7777Code:
7878
79−bc.. ---- (should be four hyphens)
79+<pre>
80+---- (should be four hyphens)
8081
8182sub status {
8283 print &quot;working&quot;;
8384}
8485
8586this code block is indented by one tab
87+</pre>
8688
8789And:
8890
89−bc.. this code block is indented by two tabs
91+<pre>
92+ this code block is indented by two tabs
9093
9194These should not be escaped: \$ \\ \&gt; \[ \{
95+</pre>
9296
9397<hr />
9498