packages: redmine/redmine-utf-regex.patch - more regex-class fixes

baggins baggins at pld-linux.org
Mon Jun 21 13:52:21 CEST 2010


Author: baggins                      Date: Mon Jun 21 11:52:21 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- more regex-class fixes

---- Files affected:
packages/redmine:
   redmine-utf-regex.patch (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: packages/redmine/redmine-utf-regex.patch
diff -u packages/redmine/redmine-utf-regex.patch:1.2 packages/redmine/redmine-utf-regex.patch:1.3
--- packages/redmine/redmine-utf-regex.patch:1.2	Mon Jun 21 13:24:20 2010
+++ packages/redmine/redmine-utf-regex.patch	Mon Jun 21 13:52:16 2010
@@ -6,7 +6,7 @@
      end
      content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
 -    content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
-+    content << text.to_s.strip.gsub(%r{<pre>((.|[:space:])*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
++    content << text.to_s.strip.gsub(%r{<pre>((.|[[:space:]])*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
      render(:update) { |page|
        page.<< "$('notes').value = \"#{content}\";"
        page.show 'update'
@@ -18,7 +18,7 @@
      subject = "RE: #{subject}" unless subject.starts_with?('RE:')
      content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
 -    content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
-+    content << text.to_s.strip.gsub(%r{<pre>((.|[:space:])*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
++    content << text.to_s.strip.gsub(%r{<pre>((.|[[:space:]])*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
      render(:update) { |page|
        page << "$('reply_subject').value = \"#{subject}\";"
        page.<< "$('message_content').value = \"#{content}\";"
@@ -30,7 +30,7 @@
      # extract tokens from the question
      # eg. hello "bye bye" => ["hello", "bye bye"]
 -    @tokens = @question.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')}
-+    @tokens = @question.scan(%r{(([:space:]|^)"[[:space:][:word:]]+"([:space:]|$)|[:space:]+)}).collect {|m| m.first.gsub(%r{(^[:space:]*"[:space:]*|[:space:]*"[:space:]*$)}, '')}
++    @tokens = @question.scan(%r{(([[:space:]]|^)"[[:space:][:word:]]+"([[:space:]]|$)|[[:space:]]+)}).collect {|m| m.first.gsub(%r{(^[[:space:]]*"[[:space:]]*|[[:space:]]*"[[:space:]]*$)}, '')}
      # tokens must be at least 2 characters long
      @tokens = @tokens.uniq.select {|w| w.length > 1 }
      
@@ -42,7 +42,7 @@
        # find any issue ID in the comments
        target_issue_ids = []
 -      comments.scan(%r{([\s\(\[,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] }
-+      comments.scan(%r{([[:space:]\(\[,-]|^)#(\d+)(?=[[:punct:]]|[:space:]|<|$)}).each { |m| target_issue_ids << m[1] }
++      comments.scan(%r{([[:space:]\(\[,-]|^)#(\d+)(?=[[:punct:]]|[[:space:]]|<|$)}).each { |m| target_issue_ids << m[1] }
        referenced_issues += find_referenced_issues_by_id(target_issue_ids)
      end
      
@@ -143,10 +143,10 @@
      @content_to = content_to
      @content_from = content_from
 -    @words = content_to.text.split(/(\s+)/)
-+    @words = content_to.text.split(/([:space:]+)/)
++    @words = content_to.text.split(/([[:space:]]+)/)
      @words = @words.select {|word| word != ' '}
 -    words_from = content_from.text.split(/(\s+)/)
-+    words_from = content_from.text.split(/([:space:]+)/)
++    words_from = content_from.text.split(/([[:space:]]+)/)
      words_from = words_from.select {|word| word != ' '}    
      @diff = words_from.diff @words
    end
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/redmine/redmine-utf-regex.patch?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list