Added needed space after .bc and .bq.

Otherwise these can trap a </dd>, for example.

Better solution to try next: rewrite using Pretty.
This commit is contained in:
John MacFarlane 2011-01-23 10:08:11 -08:00
parent 16d4366431
commit 65a015e74b
3 changed files with 172 additions and 148 deletions

View file

@ -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
@ -176,7 +176,7 @@ blockToTextile opts x@(BulletList items) = do
if useTags
then do
contents <- withUseTags $ mapM (listItemToTextile opts) items
return $ " <ul>\n" ++ vcat contents ++ " </ul>\n"
return $ "<ul>\n" ++ vcat contents ++ "\n</ul>\n"
else do
modify $ \s -> s { stListLevel = stListLevel s ++ "*" }
level <- get >>= return . length . stListLevel
@ -191,7 +191,7 @@ blockToTextile opts x@(OrderedList attribs items) = do
then do
contents <- withUseTags $ mapM (listItemToTextile opts) items
return $ "<ol" ++ listAttribsToString attribs ++ ">\n" ++ vcat contents ++
" </ol>\n"
"\n</ol>\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 $ " <dl>\n" ++ vcat contents ++ " </dl>\n"
return $ "<dl>\n" ++ vcat contents ++ "\n</dl>\n"
-- Auxiliary functions for lists:

View file

@ -45,6 +45,8 @@ E-mail style:
bq. This is a block quote. It is pretty short.
<blockquote>
Code in a block quote:
@ -62,8 +64,10 @@ Nested block quotes:
bq. nested
bq. nested
</blockquote>
This should not be a block quote: 2 &gt; 1.
@ -168,7 +172,8 @@ Multiple paragraphs:
<li><p>Item 1, graf one.</p>
<p>Item 1. graf two. The quick brown fox jumped over the lazy dog's back.</p></li>
<li><p>Item 2.</p></li>
<li> <p>Item 3.</p></li> </ol>
<li><p>Item 3.</p></li>
</ol>
h2. Nested
@ -212,9 +217,12 @@ h2. Fancy list markers
<li>more items
<ol style="list-style-type: upper-alpha;">
<li>a subsublist</li>
<li>a subsublist</li> </ol>
</li> </ol>
</li> </ol>
<li>a subsublist</li>
</ol>
</li>
</ol>
</li>
</ol>
Nesting:
@ -225,10 +233,14 @@ Nesting:
<ol start="6" style="list-style-type: decimal;">
<li>Decimal start with 6
<ol start="3" style="list-style-type: lower-alpha;">
<li>Lower alpha with paren</li> </ol>
</li> </ol>
</li> </ol>
</li> </ol>
<li>Lower alpha with paren</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
Autonumbering:
@ -254,7 +266,8 @@ Tight using spaces:
<dt>orange</dt>
<dd>orange fruit</dd>
<dt>banana</dt>
<dd>yellow fruit</dd> </dl>
<dd>yellow fruit</dd>
</dl>
Tight using tabs:
@ -264,7 +277,8 @@ Tight using tabs:
<dt>orange</dt>
<dd>orange fruit</dd>
<dt>banana</dt>
<dd>yellow fruit</dd> </dl>
<dd>yellow fruit</dd>
</dl>
Loose:
@ -274,7 +288,8 @@ Loose:
<dt>orange</dt>
<dd><p>orange fruit</p></dd>
<dt>banana</dt>
<dd> <p>yellow fruit</p></dd> </dl>
<dd><p>yellow fruit</p></dd>
</dl>
Multiple blocks with italics:
@ -286,7 +301,10 @@ Multiple blocks with italics:
<dd><p>orange fruit</p>
bc. { orange code block }
bq. <p>orange block quote</p></dd> </dl>
bq. <p>orange block quote</p>
</dd>
</dl>
Multiple definitions, tight:
@ -296,7 +314,8 @@ Multiple definitions, tight:
<dd>computer</dd>
<dt>orange</dt>
<dd>orange fruit</dd>
<dd>bank</dd> </dl>
<dd>bank</dd>
</dl>
Multiple definitions, loose:
@ -306,7 +325,8 @@ Multiple definitions, loose:
<dd><p>computer</p></dd>
<dt>orange</dt>
<dd><p>orange fruit</p></dd>
<dd> <p>bank</p></dd> </dl>
<dd><p>bank</p></dd>
</dl>
Blank line after term, indented marker, alternate markers:
@ -318,8 +338,10 @@ Blank line after term, indented marker, alternate markers:
<dd><p>orange fruit</p>
<ol style="list-style-type: decimal;">
<li>sublist</li>
<li>sublist</li> </ol>
</dd> </dl>
<li>sublist</li>
</ol>
</dd>
</dl>
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: @<http://example.com/>@
bc. or here: <http://example.com/>
@ -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.