Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed lines starting with dashes being recognized as a definition lis…
…t when there were no definitions. [#21 state:resolved]
  • Loading branch information
jgarber committed Jul 24, 2008
1 parent bb00efb commit a68fb74
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
@@ -1,5 +1,6 @@
= Edge

* Fixed lines starting with dashes being recognized as a definition list when there were no definitions.
* Created alias RedCloth.rb so Rails 2.1 gem dependency works on case-sensitive operating systems .
* Fixed parsing sentences that had two em dashes surrounded by spaces from becoming del phrases. #19
* Fixed links including prior quoted phrases. #17
Expand Down
9 changes: 5 additions & 4 deletions ext/redcloth_scan/redcloth_scan.rl
Expand Up @@ -40,9 +40,10 @@ int SYM_escape_preformatted;
ul = "*" %{nest++; list_type = "ul";};
ol = "#" %{nest++; list_type = "ol";};
list_start = ( ( ul | ol )+ N A C :> " "+ ) >{nest = 0;} ;
dl_start = "-" . " "+ ;
dt_start = "-" . " "+ ;
dd_start = ":=" ;
long_dd = dd_start " "* LF %{ ADD_BLOCK(); ASET(type, dd); } any+ >A %{ TRANSFORM(text) } :>> "=:" ;
dl_start = (dt_start mtext (LF dt_start mtext)* " "* dd_start) ;
blank_line = LF;
link_alias = ( "[" >{ ASET(type, ignore) } %A phrase %T "]" %A uri %{ STORE_URL(href); } ) ;

Expand Down Expand Up @@ -285,13 +286,13 @@ int SYM_escape_preformatted;
*|;

list := |*
LF list_start { ADD_BLOCK(); LIST_ITEM(); };
LF list_start { ADD_BLOCK(); LIST_ITEM(); };
block_end { ADD_BLOCK(); nest = 0; LIST_CLOSE(); fgoto main; };
default => cat;
*|;

dl := |*
LF dl_start { ADD_BLOCK(); ASET(type, dt); };
LF dt_start { ADD_BLOCK(); ASET(type, dt); };
dd_start { ADD_BLOCK(); ASET(type, dd); };
long_dd { INLINE(html, dd); };
block_end { ADD_BLOCK(); INLINE(html, dl_close); fgoto main; };
Expand All @@ -312,7 +313,7 @@ int SYM_escape_preformatted;
block_start { fgoto block; };
footnote_start { fgoto footnote; };
list_start { list_layout = rb_ary_new(); LIST_ITEM(); fgoto list; };
dl_start { INLINE(html, dl_open); ASET(type, dt); fgoto dl; };
dl_start { p = ts; INLINE(html, dl_open); ASET(type, dt); fgoto dl; };
table { INLINE(table, table_close); DONE(table); fgoto block; };
link_alias { rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href")))); DONE(block); };
aligned_image { rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block); fgoto block; };
Expand Down
11 changes: 11 additions & 0 deletions test/definitions.yml
Expand Up @@ -48,6 +48,17 @@ html: |-
<dd>woven threads</dd>
</dl>
---
name: not a definition list
desc: a definition list with no definitions is not a definition list
in: |-
- textile
- fabric
- cloth
html: |-
<p>- textile<br />
- fabric<br />
- cloth</p>
---
name: long definition list
in: |-
here is a long definition
Expand Down

0 comments on commit a68fb74

Please sign in to comment.