From 78dfef097803532fee664461f6485175917c1990 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sat, 24 Oct 2020 06:46:50 +0000 Subject: Replace gsub with tr, delete, or squeeze (#34161). git-svn-id: http://svn.redmine.org/redmine/trunk@20176 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/core_ext/string/conversions.rb | 2 +- lib/redmine/wiki_formatting/textile/redcloth3.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/redmine') diff --git a/lib/redmine/core_ext/string/conversions.rb b/lib/redmine/core_ext/string/conversions.rb index a6ff884ec..c52b334e4 100644 --- a/lib/redmine/core_ext/string/conversions.rb +++ b/lib/redmine/core_ext/string/conversions.rb @@ -38,7 +38,7 @@ module Redmine s.gsub!(%r{^((\d+)\s*(h|hours?))?\s*((\d+)\s*(m|min)?)?$}i) { |m| ($1 || $4) ? ($2.to_i + $5.to_i / 60.0) : m[0] } end # 2,5 => 2.5 - s.gsub!(',', '.') + s.tr!(',', '.') begin; Kernel.Float(s); rescue; nil; end end end diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index b47296b1b..3c43a54d9 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -1016,7 +1016,7 @@ class RedCloth3 < String def clean_white_space( text ) # normalize line breaks text.gsub!( /\r\n/, "\n" ) - text.gsub!( /\r/, "\n" ) + text.tr!( "\r", "\n" ) text.gsub!( /\t/, ' ' ) text.gsub!( /^ +$/, '' ) text.gsub!( /\n{3,}/, "\n\n" ) -- cgit v1.2.3