summaryrefslogtreecommitdiffstats
path: root/lib/redmine/wiki_formatting
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-01-11 11:27:25 +0000
committerGo MAEDA <maeda@farend.jp>2024-01-11 11:27:25 +0000
commit5b77092be4936f36c77f495b08af3976d2ca4774 (patch)
tree9c23d4415e8a9c7470747a9136048e3b2d3b2294 /lib/redmine/wiki_formatting
parentb57a3a187c78647499d490a99d8f493dbf5e6c15 (diff)
downloadredmine-5b77092be4936f36c77f495b08af3976d2ca4774.tar.gz
redmine-5b77092be4936f36c77f495b08af3976d2ca4774.zip
Replace regular expression matches with String#start_with? / end_with? (#40010).
Patch by Go MAEDA (@maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22605 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting')
-rw-r--r--lib/redmine/wiki_formatting/textile/redcloth3.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 647bd6f8b..3bc8ea29d 100644
--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
@@ -537,7 +537,7 @@ class RedCloth3 < String
# the regexp prevents wiki links with a | from being cut as cells
row.scan(/\|(_?#{S}#{A}#{C}\. ?)?((\[\[[^|\]]*\|[^|\]]*\]\]|[^|])*?)(?=\|)/o) do |modifiers, cell|
ctyp = 'd'
- ctyp = 'h' if modifiers && modifiers =~ /^_/
+ ctyp = 'h' if modifiers&.start_with?('_')
catts = nil
catts = pba( modifiers, 'td' ) if modifiers
@@ -637,7 +637,7 @@ class RedCloth3 < String
end
def lT( text )
- /\#$/.match?(text) ? 'o' : 'u'
+ text.end_with?('#') ? 'o' : 'u'
end
def hard_break( text )
@@ -673,7 +673,7 @@ class RedCloth3 < String
block_applied = 0
@rules.each do |rule_name|
- block_applied += 1 if rule_name.to_s.match /^block_/ and method(rule_name).call(blk)
+ block_applied += 1 if rule_name.to_s.start_with?('block_') and method(rule_name).call(blk)
end
if block_applied.zero?
if deep_code
@@ -909,7 +909,7 @@ class RedCloth3 < String
def refs( text )
@rules.each do |rule_name|
- method( rule_name ).call( text ) if rule_name.to_s.match? /^refs_/
+ method( rule_name ).call( text ) if rule_name.to_s.start_with?('refs_')
end
end