Textile writer: Use <pre> instead of bc.. for code with blank lines.
This has fewer interaction effects.
This commit is contained in:
parent
1d683be414
commit
7234a79104
2 changed files with 14 additions and 7 deletions
|
@ -118,15 +118,18 @@ blockToTextile opts (Header level inlines) = do
|
||||||
let prefix = 'h' : (show level ++ ". ")
|
let prefix = 'h' : (show level ++ ". ")
|
||||||
return $ prefix ++ contents ++ "\n"
|
return $ prefix ++ contents ++ "\n"
|
||||||
|
|
||||||
|
blockToTextile _ (CodeBlock (_,classes,_) str) | any (all isSpace) (lines str) =
|
||||||
|
return $ "<pre" ++ classes' ++ ">\n" ++ escapeStringForXML str ++
|
||||||
|
"\n</pre>\n"
|
||||||
|
where classes' = if null classes
|
||||||
|
then ""
|
||||||
|
else " class=\"" ++ unwords classes ++ "\""
|
||||||
|
|
||||||
blockToTextile _ (CodeBlock (_,classes,_) str) =
|
blockToTextile _ (CodeBlock (_,classes,_) str) =
|
||||||
return $ "bc" ++ classes' ++ dots ++ escapeStringForXML str ++ "\n"
|
return $ "bc" ++ classes' ++ ". " ++ escapeStringForXML str ++ "\n"
|
||||||
where classes' = if null classes
|
where classes' = if null classes
|
||||||
then ""
|
then ""
|
||||||
else "(" ++ unwords classes ++ ")"
|
else "(" ++ unwords classes ++ ")"
|
||||||
dots = if any isBlank (lines str)
|
|
||||||
then ".. "
|
|
||||||
else ". "
|
|
||||||
isBlank = all isSpace
|
|
||||||
|
|
||||||
blockToTextile opts (BlockQuote bs@[Para _]) = do
|
blockToTextile opts (BlockQuote bs@[Para _]) = do
|
||||||
contents <- blockListToTextile opts bs
|
contents <- blockListToTextile opts bs
|
||||||
|
|
|
@ -76,19 +76,23 @@ h1. Code Blocks
|
||||||
|
|
||||||
Code:
|
Code:
|
||||||
|
|
||||||
bc.. ---- (should be four hyphens)
|
<pre>
|
||||||
|
---- (should be four hyphens)
|
||||||
|
|
||||||
sub status {
|
sub status {
|
||||||
print "working";
|
print "working";
|
||||||
}
|
}
|
||||||
|
|
||||||
this code block is indented by one tab
|
this code block is indented by one tab
|
||||||
|
</pre>
|
||||||
|
|
||||||
And:
|
And:
|
||||||
|
|
||||||
bc.. this code block is indented by two tabs
|
<pre>
|
||||||
|
this code block is indented by two tabs
|
||||||
|
|
||||||
These should not be escaped: \$ \\ \> \[ \{
|
These should not be escaped: \$ \\ \> \[ \{
|
||||||
|
</pre>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue