mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2025-02-28 08:21:52 -05:00
apply "o" option to regexps to improve process time
Signed-off-by: Brandon Mathis <brandon@imathis.com>
This commit is contained in:
parent
33073156bc
commit
590b35ce4e
@ -401,8 +401,8 @@ class RubyPants < String
|
|||||||
# Special case if the very first character is a quote followed by
|
# Special case if the very first character is a quote followed by
|
||||||
# punctuation at a non-word-break. Close the quotes by brute
|
# punctuation at a non-word-break. Close the quotes by brute
|
||||||
# force:
|
# force:
|
||||||
str.gsub!(/^'(?=#{punct_class}\B)/, '’')
|
str.gsub!(/^'(?=#{punct_class}\B)/o, '’')
|
||||||
str.gsub!(/^"(?=#{punct_class}\B)/, '”')
|
str.gsub!(/^"(?=#{punct_class}\B)/o, '”')
|
||||||
|
|
||||||
# Special case for double sets of quotes, e.g.:
|
# Special case for double sets of quotes, e.g.:
|
||||||
# <p>He said, "'Quoted' words in a larger quote."</p>
|
# <p>He said, "'Quoted' words in a larger quote."</p>
|
||||||
@ -416,19 +416,19 @@ class RubyPants < String
|
|||||||
dec_dashes = '–|—'
|
dec_dashes = '–|—'
|
||||||
|
|
||||||
# Get most opening single quotes:
|
# Get most opening single quotes:
|
||||||
str.gsub!(/(\s| |--|&[mn]dash;|#{dec_dashes}|ȁ[34];)'(?=\w)/,
|
str.gsub!(/(\s| |--|&[mn]dash;|#{dec_dashes}|ȁ[34];)'(?=\w)/o,
|
||||||
'\1‘')
|
'\1‘')
|
||||||
# Single closing quotes:
|
# Single closing quotes:
|
||||||
str.gsub!(/(#{close_class})'/, '\1’')
|
str.gsub!(/(#{close_class})'/o, '\1’')
|
||||||
str.gsub!(/'(\s|s\b|$)/, '’\1')
|
str.gsub!(/'(\s|s\b|$)/, '’\1')
|
||||||
# Any remaining single quotes should be opening ones:
|
# Any remaining single quotes should be opening ones:
|
||||||
str.gsub!(/'/, '‘')
|
str.gsub!(/'/, '‘')
|
||||||
|
|
||||||
# Get most opening double quotes:
|
# Get most opening double quotes:
|
||||||
str.gsub!(/(\s| |--|&[mn]dash;|#{dec_dashes}|ȁ[34];)"(?=\w)/,
|
str.gsub!(/(\s| |--|&[mn]dash;|#{dec_dashes}|ȁ[34];)"(?=\w)/o,
|
||||||
'\1“')
|
'\1“')
|
||||||
# Double closing quotes:
|
# Double closing quotes:
|
||||||
str.gsub!(/(#{close_class})"/, '\1”')
|
str.gsub!(/(#{close_class})"/o, '\1”')
|
||||||
str.gsub!(/"(\s|s\b|$)/, '”\1')
|
str.gsub!(/"(\s|s\b|$)/, '”\1')
|
||||||
# Any remaining quotes should be opening ones:
|
# Any remaining quotes should be opening ones:
|
||||||
str.gsub!(/"/, '“')
|
str.gsub!(/"/, '“')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user