<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,16 @@
 === Edge
 
+* Change to list attributes so you can give style/class to list items (taken from PyTextile).  Breaks backwards compatibility.
+  
+  Before, the style applied to the first list item applied to the entire list.  Now, class/id/style placed
+  before the list applies to the list element and after the hash or asterisk applies to the list item.  For
+  example:
+                                   &lt;ul id=&quot;groceries&quot;&gt;
+    (#groceries)# Milk               &lt;li&gt;milk&lt;/li&gt;
+    # Eggs                           &lt;li&gt;eggs&lt;/li&gt;
+    #(optional) granola              &lt;li class=&quot;optional&quot;&gt;granola&lt;/li&gt;
+                                   &lt;/ul&gt;
+
 * Separated attributes out to have their own mark/store variable and regs.  This way, they won't conflict with captured text or backtracked text. [Jason Garber]
 
 * Added a RedCloth::EXTENSION_LANGUAGE constant so you can tell what version of the parser you are using. [Jason Garber]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@
 
   machine redcloth_attributes;
   
-  C2 = ( C_CLAS | C_STYL | C_LNGE )+ ;
+  C2 = ( C_CLASS_ID | C_STYL | C_LNGE )+ ;
 
   mtext_with_attributes = ( C2 mtext &gt;A %T ) &gt;X ;
 </diff>
      <filename>ext/redcloth_scan/redcloth_attributes.rl</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 %%{
   
   machine redcloth_common;
-  include redcloth_common &quot;redcloth_common.rl&quot;;
   
   action esc { rb_str_cat_escaped(@block, @ts, @te); }
   action esc_pre { rb_str_cat_escaped_for_preformatted(@block, STR_NEW(@ts, @te-@ts)); }
@@ -16,5 +15,15 @@
   }
   action extended { !@extend.nil? }
   action not_extended { @extend.nil? }
+  action following_hash_is_ol_not_id { 
+    if @data[(@p+1), 1] == &quot;#&quot;
+      @data[(@p+2), 1] == &quot;#&quot; || @data[(@p+2), 1] == &quot;*&quot; || @data[(@p+2), 1] == &quot; &quot;
+    else
+      true
+    end
+  }
+  
+  
+  include redcloth_common &quot;redcloth_common.rl&quot;;
   
 }%%;
\ No newline at end of file</diff>
      <filename>ext/redcloth_scan/redcloth_common.rb.rl</filename>
    </modified>
    <modified>
      <diff>@@ -20,12 +20,14 @@
   A_RIGHT = &quot;&gt;&quot; %{ ATTR_SET(&quot;align&quot;, &quot;right&quot;); } ;
   A_JUSTIFIED = &quot;&lt;&gt;&quot; %{ ATTR_SET(&quot;align&quot;, &quot;justify&quot;); } ;
   A_CENTER = &quot;=&quot; %{ ATTR_SET(&quot;align&quot;, &quot;center&quot;); } ;
-  A_PADLEFT = &quot;(&quot; %{ ATTR_INC(&quot;padding-left&quot;); } ;
+  A_PADLEFT = &quot;(&quot; when following_hash_is_ol_not_id %{ ATTR_INC(&quot;padding-left&quot;); } ;
   A_PADRIGHT = &quot;)&quot; %{ ATTR_INC(&quot;padding-right&quot;); } ;
   A_HLGN = ( A_LEFT | A_RIGHT | A_JUSTIFIED | A_CENTER | A_PADLEFT | A_PADRIGHT ) ;
   A_LIMIT = ( A_LEFT | A_CENTER | A_RIGHT ) ;
   A_VLGN = ( &quot;-&quot; %{ ATTR_SET(&quot;vertical-align&quot;, &quot;middle&quot;); } | &quot;^&quot; %{ ATTR_SET(&quot;vertical-align&quot;, &quot;top&quot;); } | &quot;~&quot; %{ ATTR_SET(&quot;vertical-align&quot;, &quot;bottom&quot;); } ) ;
-  C_CLAS = ( &quot;(&quot; ( [^)#]+ &gt;ATTR %{ STORE_ATTR(&quot;class&quot;); } )? (&quot;#&quot; [^)]+ &gt;ATTR %{STORE_ATTR(&quot;id&quot;);} )? &quot;)&quot; ) ;
+  C_CLASS = [^()#]+ &gt;ATTR %{ STORE_ATTR(&quot;class&quot;); } ;
+  C_ID = &quot;#&quot; [^) ]+ &gt;ATTR %{STORE_ATTR(&quot;id&quot;);} ;
+  C_CLASS_ID = &quot;(&quot; ( C_CLASS | C_ID | C_CLASS C_ID ) &quot;)&quot; ;
   C_LNGE = ( &quot;[&quot; [^\]]+ &gt;ATTR %{ STORE_ATTR(&quot;lang&quot;); } &quot;]&quot; ) ;
   C_STYL = ( &quot;{&quot; [^}]+ &gt;ATTR %{ STORE_ATTR(&quot;style&quot;); } &quot;}&quot; ) ;
   S_CSPN = ( &quot;\\&quot; [0-9]+ &gt;ATTR %{ STORE_ATTR(&quot;colspan&quot;); } ) ;
@@ -34,7 +36,7 @@
   A = ( ( A_HLGN | A_VLGN )* ) ;
   A2 = ( A_LIMIT? ) ;
   S = ( S_CSPN | S_RSPN )* ;
-  C = ( C_CLAS | C_STYL | C_LNGE )* ;
+  C = ( C_CLASS_ID | C_STYL | C_LNGE )* ;
   D = ( D_HEADER ) ;
   N_CONT = &quot;_&quot; %{ ATTR_SET(&quot;list_continue&quot;, &quot;true&quot;); };
   N_NUM = digit+ &gt;ATTR %{ STORE_ATTR(&quot;start&quot;); };
@@ -52,12 +54,15 @@
   A_PADRIGHT_noactions = &quot;)&quot;  ;
   A_HLGN_noactions = ( A_LEFT_noactions | A_RIGHT_noactions | A_JUSTIFIED_noactions | A_CENTER_noactions | A_PADLEFT_noactions | A_PADRIGHT_noactions ) ;
   A_VLGN_noactions = ( &quot;-&quot; | &quot;^&quot; | &quot;~&quot; ) ;
-  C_CLAS_noactions = ( &quot;(&quot; ( [^)#]+ )? (&quot;#&quot; [^)]+ )? &quot;)&quot; ) ;
+  C_CLASS_noactions = ( &quot;(&quot; ( [^)#]+ )? (&quot;#&quot; [^)]+ )? &quot;)&quot; ) ;
   C_LNGE_noactions = ( &quot;[&quot; [^\]]+ &quot;]&quot; ) ;
   C_STYL_noactions = ( &quot;{&quot; [^}]+ &quot;}&quot; ) ;
   A_noactions = ( ( A_HLGN_noactions | A_VLGN_noactions )* ) ;
-  C_noactions = ( C_CLAS_noactions | C_STYL_noactions | C_LNGE_noactions )* ;
+  C_noactions = ( C_CLASS_noactions | C_STYL_noactions | C_LNGE_noactions )* ;
   C_noquotes_noactions = C_noactions -- '&quot;' ;
+  N_CONT_noactions = &quot;_&quot; ;
+  N_NUM_noactions = digit+ ;
+  N_noactions = ( N_CONT_noactions | N_NUM_noactions )? ;
 
   # text blocks
   trailing = PUNCT - (&quot;'&quot; | '&quot;') ;</diff>
      <filename>ext/redcloth_scan/redcloth_common.rl</filename>
    </modified>
    <modified>
      <diff>@@ -216,7 +216,7 @@ module RedCloth
       end
     end
     def STORE_ATTR(t)
-      if (@attr_reg &amp;&amp; @p &gt; @attr_reg &amp;&amp; @attr_reg &gt;= @ts)
+      if (@attr_reg &amp;&amp; @p &gt; @attr_reg &amp;&amp; (@attr_reg &gt;= (@ts || 0)))
         str = @data[@attr_reg, @p - @attr_reg]
         @attr_regs[t.to_sym] = str
         # /*printf(&quot;STORE_B(&quot; T &quot;) '%s' (p:'%s' reg:'%s')\n&quot;, RSTRING_PTR(str), p, reg);*/  \
@@ -274,14 +274,15 @@ module RedCloth
     def RESET_NEST()
       @nest = 0
     end
-    def LIST_ITEM_OPEN()
+    def LIST_LAYOUT()
       aint = 0
       aval = @list_index[@nest-1]
       aint = aval.to_i unless aval.nil?
-      if (@list_type == &quot;ol&quot;)
+      if (@list_type == &quot;ol&quot; &amp;&amp; @nest &gt; 0)
         @list_index[@nest-1] = aint + 1
       end
       if (@nest &gt; @list_layout.length)
+        SET_ATTRIBUTES();
         listm = sprintf(&quot;%s_open&quot;, @list_type)
         if (@regs[:list_continue])
           @regs[:list_continue] = nil
@@ -302,6 +303,8 @@ module RedCloth
         ASET(&quot;first&quot;, true)
       end
       LIST_CLOSE()
+      LIST_ITEM_CLOSE() unless @nest == 0
+      CLEAR_REGS()
       @regs[:nest] = @list_layout.length
       ASET(&quot;type&quot;, &quot;li_open&quot;)
     end</diff>
      <filename>ext/redcloth_scan/redcloth_scan.rb.rl</filename>
    </modified>
    <modified>
      <diff>@@ -27,9 +27,10 @@
   footnote_start = ( ftype A C :&gt; dotspace ) %SET_ATTR ;
   ul = &quot;*&quot; %{NEST(); SET_LIST_TYPE(&quot;ul&quot;);};
   ol = &quot;#&quot; %{NEST(); SET_LIST_TYPE(&quot;ol&quot;);};
-  ul_start  = ( ul | ol )* ul A C :&gt; &quot; &quot;+ %SET_ATTR;
-  ol_start  = ( ul | ol )* ol N A C :&gt; &quot; &quot;+ %SET_ATTR ;
-  list_start  = &quot; &quot;* ( ul_start | ol_start ) &gt;{RESET_NEST();} ;
+  ul_start  = ( ul | ol )* ul A_noactions C_noactions :&gt; &quot; &quot;+ ;
+  ol_start  = ( ul | ol )* ol N A_noactions C_noactions :&gt; &quot; &quot;+ ;
+  list_start  = &quot; &quot;* A C ( ul_start | ol_start ) &gt;B &gt;{RESET_NEST();} @{ fexec(bck); } ;
+  
   dt_start = &quot;-&quot; . &quot; &quot;+ ;
   dd_start = &quot;:=&quot; ;
   long_dd  = dd_start &quot; &quot;* LF %{ ADD_BLOCK(); ASET(&quot;type&quot;, &quot;dd&quot;); } any+ &gt;A %{ TRANSFORM(&quot;text&quot;); } :&gt;&gt; &quot;=:&quot; ;
@@ -134,7 +135,7 @@
     double_return next_block_start when not_extended { ADD_BLOCK(); fgoto main; };
     html_end_terminating_block when extended { ADD_EXTENDED_BLOCK(); END_EXTENDED(); fgoto main; };
     html_end_terminating_block when not_extended { ADD_BLOCK(); fgoto main; };
-    LF list_start { ADD_BLOCK(); CLEAR_LIST(); LIST_ITEM_OPEN(); fgoto list; };
+    LF list_start { ADD_BLOCK(); CLEAR_LIST(); LIST_LAYOUT(); fgoto list_item; };
     
     default =&gt; cat;
   *|;
@@ -143,10 +144,14 @@
     block_end       { ADD_BLOCK(); fgoto main; };
     default =&gt; cat;
   *|;
-
-  list := |*
-    LF list_start   { LIST_ITEM_CLOSE(); ADD_BLOCK(); LIST_ITEM_OPEN(); };
-    block_end       { LIST_ITEM_CLOSE(); ADD_BLOCK(); RESET_NEST(); LIST_CLOSE(); fgoto main; };
+  
+  ul_item  = ( ul | ol )* ul A C :&gt; &quot; &quot;+ ;
+  ol_item  = ( ul | ol )* ol N_noactions A C :&gt; &quot; &quot;+ ;
+  list_item  := (&quot; &quot;* ( ul_item | ol_item )) @{ SET_ATTRIBUTES(); fgoto list_content; } ;
+  
+  list_content := |*
+    LF list_start { ADD_BLOCK(); LIST_LAYOUT(); fgoto list_item; };
+    block_end     { ADD_BLOCK(); RESET_NEST(); LIST_LAYOUT(); fgoto main; };
     default =&gt; cat;
   *|;
 
@@ -172,7 +177,7 @@
     block_start     { fgoto block; };
     footnote_start  { fgoto footnote; };
     horizontal_rule { INLINE(html, &quot;hr&quot;); };
-    list_start      { CLEAR_LIST(); LIST_ITEM_OPEN(); fgoto list; };
+    list_start      { CLEAR_LIST(); LIST_LAYOUT(); fgoto list_item; };
     dl_start        { fexec(ts + 1); INLINE(html, &quot;dl_open&quot;); ASET(&quot;type&quot;, &quot;dt&quot;); fgoto dl; };
     table           { INLINE(table, &quot;table_close&quot;); DONE(table); fgoto block; };
     link_alias      { STORE_LINK_ALIAS(); DONE(block); };</diff>
      <filename>ext/redcloth_scan/redcloth_scan.rl</filename>
    </modified>
    <modified>
      <diff>@@ -306,10 +306,10 @@ in: |-
   *(class-two) two
   *(class-three) three
 html: |-
-  &lt;ul class=&quot;class-one&quot;&gt;
-  	&lt;li&gt;one&lt;/li&gt;
-  	&lt;li&gt;two&lt;/li&gt;
-  	&lt;li&gt;three&lt;/li&gt;
+  &lt;ul&gt;
+  	&lt;li class=&quot;class-one&quot;&gt;one&lt;/li&gt;
+  	&lt;li class=&quot;class-two&quot;&gt;two&lt;/li&gt;
+  	&lt;li class=&quot;class-three&quot;&gt;three&lt;/li&gt;
   &lt;/ul&gt;
 ---
 name: unordered with alignments
@@ -319,11 +319,11 @@ in: |-
   *&lt;&gt; three
   *= four
 html: |-
-  &lt;ul style=&quot;text-align:left;&quot;&gt;
-  	&lt;li&gt;one&lt;/li&gt;
-  	&lt;li&gt;two&lt;/li&gt;
-  	&lt;li&gt;three&lt;/li&gt;
-  	&lt;li&gt;four&lt;/li&gt;
+  &lt;ul&gt;
+  	&lt;li style=&quot;text-align:left;&quot;&gt;one&lt;/li&gt;
+  	&lt;li style=&quot;text-align:right;&quot;&gt;two&lt;/li&gt;
+  	&lt;li style=&quot;text-align:justify;&quot;&gt;three&lt;/li&gt;
+  	&lt;li style=&quot;text-align:center;&quot;&gt;four&lt;/li&gt;
   &lt;/ul&gt;
 ---
 name: with attributes that apply to the whole list
@@ -338,6 +338,42 @@ html: |-
   	&lt;li&gt;three&lt;/li&gt;
   &lt;/ol&gt;
 ---
+name: with id on the list
+in: |-
+  (#my-id)# one
+  # two
+  # three
+html: |-
+  &lt;ol id=&quot;my-id&quot;&gt;
+  	&lt;li&gt;one&lt;/li&gt;
+  	&lt;li&gt;two&lt;/li&gt;
+  	&lt;li&gt;three&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with class on the list
+in: |-
+  (my-class)# one
+  # two
+  # three
+html: |-
+  &lt;ol class=&quot;my-class&quot;&gt;
+  	&lt;li&gt;one&lt;/li&gt;
+  	&lt;li&gt;two&lt;/li&gt;
+  	&lt;li&gt;three&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with id on the list item
+in: |-
+  # one
+  #(#my-item) two
+  # three
+html: |-
+  &lt;ol&gt;
+  	&lt;li&gt;one&lt;/li&gt;
+  	&lt;li id=&quot;my-item&quot;&gt;two&lt;/li&gt;
+  	&lt;li&gt;three&lt;/li&gt;
+  &lt;/ol&gt;
+---
 name: with attributes that apply to the first list item
 in: |-
   #(class#id) one
@@ -348,4 +384,79 @@ html: |-
   	&lt;li class=&quot;class&quot; id=&quot;id&quot;&gt;one&lt;/li&gt;
   	&lt;li&gt;two&lt;/li&gt;
   	&lt;li&gt;three&lt;/li&gt;
-  &lt;/ol&gt;
\ No newline at end of file
+  &lt;/ol&gt;
+---
+name: changed from textism basics
+desc: &quot;This was in Textism basics, but when I changed the format of list styles, I removed it&quot;
+in: |-
+  {color:blue}# one
+  # two
+  # three
+html: |-
+  &lt;ol style=&quot;color:blue;&quot;&gt;
+  	&lt;li&gt;one&lt;/li&gt;
+  	&lt;li&gt;two&lt;/li&gt;
+  	&lt;li&gt;three&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: changed from threshold list attributes
+desc: &quot;Was: 'Attributes applied to the first list item will apply to the list itself.' but then we changed it&quot;
+in: |-
+  *{color:red} Item one
+  * Item two
+  * Item three
+html: |-
+  &lt;ul&gt;
+  	&lt;li style=&quot;color:red;&quot;&gt;Item one&lt;/li&gt;
+  	&lt;li&gt;Item two&lt;/li&gt;
+  	&lt;li&gt;Item three&lt;/li&gt;
+  &lt;/ul&gt;
+---
+name: with one padding-left increment
+in: &quot;(# one&quot;
+html: |-
+  &lt;ol style=&quot;padding-left:1em;&quot;&gt;
+  	&lt;li&gt;one&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with one padding-left increment and class
+in: &quot;((myclass)# one&quot;
+html: |-
+  &lt;ol style=&quot;padding-left:1em;&quot; class=&quot;myclass&quot;&gt;
+  	&lt;li&gt;one&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with two padding-left increments
+in: &quot;((# two&quot;
+html: |-
+  &lt;ol style=&quot;padding-left:2em;&quot;&gt;
+  	&lt;li&gt;two&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with one padding-right increment
+in: &quot;)# one&quot;
+html: |-
+  &lt;ol style=&quot;padding-right:1em;&quot;&gt;
+  	&lt;li&gt;one&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with padding-left and padding-right increments
+in: &quot;()# two&quot;
+html: |-
+  &lt;ol style=&quot;padding-left:1em;padding-right:1em;&quot;&gt;
+  	&lt;li&gt;two&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with padding-left and padding-right increments switched
+in: &quot;)(# two&quot;
+html: |-
+  &lt;ol style=&quot;padding-left:1em;padding-right:1em;&quot;&gt;
+  	&lt;li&gt;two&lt;/li&gt;
+  &lt;/ol&gt;
+---
+name: with padding-left and padding-right increments and class
+in: &quot;()(myclass)# two&quot;
+html: |-
+  &lt;ol style=&quot;padding-left:1em;padding-right:1em;&quot; class=&quot;myclass&quot;&gt;
+  	&lt;li&gt;two&lt;/li&gt;
+  &lt;/ol&gt;</diff>
      <filename>spec/fixtures/lists.yml</filename>
    </modified>
    <modified>
      <diff>@@ -282,7 +282,7 @@ in: |-
   
   Simple list:
   
-  #{color:blue} one
+  # one
   # two
   # three
   
@@ -305,7 +305,7 @@ html: |-
   &lt;p lang=&quot;fr&quot;&gt;This is a block quote. I&amp;#8217;ll admit it&amp;#8217;s not the most exciting block quote ever devised.&lt;/p&gt;
   &lt;/blockquote&gt;
   &lt;p&gt;Simple list:&lt;/p&gt;
-  &lt;ol style=&quot;color:blue;&quot;&gt;
+  &lt;ol&gt;
   	&lt;li&gt;one&lt;/li&gt;
   	&lt;li&gt;two&lt;/li&gt;
   	&lt;li&gt;three&lt;/li&gt;</diff>
      <filename>spec/fixtures/textism.yml</filename>
    </modified>
    <modified>
      <diff>@@ -565,19 +565,6 @@ html: |-
   	&lt;li&gt;Item C&lt;/li&gt;
   &lt;/ul&gt;
 ---
-name: list attributes
-desc: Attributes applied to the first list item will apply to the list itself.
-in: |-
-  *{color:red} Item one
-  * Item two
-  * Item three
-html: |-
-  &lt;ul style=&quot;color:red;&quot;&gt;
-  	&lt;li&gt;Item one&lt;/li&gt;
-  	&lt;li&gt;Item two&lt;/li&gt;
-  	&lt;li&gt;Item three&lt;/li&gt;
-  &lt;/ul&gt;
----
 name: nested lists
 desc: Use multiple # or * symbols to create nested lists.
 in: |-</diff>
      <filename>spec/fixtures/threshold.yml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a68d5f7b9334dbdad12fb9ddc968db11a178514e</id>
    </parent>
  </parents>
  <author>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </author>
  <url>http://github.com/jgarber/redcloth/commit/1a45c0c34cdc663c144c848f416af682ccee8b01</url>
  <id>1a45c0c34cdc663c144c848f416af682ccee8b01</id>
  <committed-date>2009-05-22T08:32:38-07:00</committed-date>
  <authored-date>2009-05-22T08:32:38-07:00</authored-date>
  <message>Change to list attributes so you can give style/class to list items (taken from PyTextile).  Breaks backwards compatibility.</message>
  <tree>b035b680669492805c2fde650c217f70c5d7deb9</tree>
  <committer>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </committer>
</commit>
