Package: redcloth
Version: 3.0.4-2
Severity: normal
Tags: patch

Hi,

When using the notextile modifier, double equalsign (==), the directive is
disregarded, while using the <notextile/> pseudo tag it DOES work:

>> RedCloth.new("This is ==_not working_==.").to_html
=> "<p>This is <em>not working</em>.</p>"
>> RedCloth.new("But this is <notextile>_working_</notextile>.").to_html
=> "<p>But this is _working_.</p>"

I found out after some debugging that this happens case because rip_offtags()
is called _before_ no_textile().  I have attached a patch that fixes this.
It also adjusts the notextile regexps somewhat to remove the needless match
for .*? after matching [^=]+ making it actually equal to [^=]+?.

Regards,

Paul

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (102, 'experimental')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-1-powerpc
Locale: LANG=C, LC_CTYPE=nl_NL.UTF8 (charmap=UTF-8)
--- lib/redcloth.rb.orig        2006-10-09 20:22:16.000000000 +0200
+++ lib/redcloth.rb     2006-10-09 18:56:23.000000000 +0200
@@ -293,8 +293,8 @@
 
         # start processor
         @pre_list = []
-        rip_offtags text
         no_textile text
+        rip_offtags text
         hard_break text 
         unless @lite_mode
             refs text
@@ -936,9 +936,9 @@
     end
 
     def no_textile( text ) 
-        text.gsub!( /(^|\s)==([^=]+.*?)==(\s|$)?/,
+        text.gsub!( /(^|\s)==([^=]+?)==(\s|$)?/,
             '\1<notextile>\2</notextile>\3' )
-        text.gsub!( /^ *==([^=]+.*?)==/m,
+        text.gsub!( /^ *==([^=]+?)==/m,
             '\1<notextile>\2</notextile>\3' )
     end
 

Reply via email to