Created
March 29, 2012 09:29
-
-
Save arika/2235373 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/plugins/rubypants.rb b/plugins/rubypants.rb | |
index e4f4502..1790821 100644 | |
--- a/plugins/rubypants.rb | |
+++ b/plugins/rubypants.rb | |
@@ -401,8 +401,8 @@ class RubyPants < String | |
# Special case if the very first character is a quote followed by | |
# punctuation at a non-word-break. Close the quotes by brute | |
# force: | |
- str.gsub!(/^'(?=#{punct_class}\B)/, '’') | |
- str.gsub!(/^"(?=#{punct_class}\B)/, '”') | |
+ str.gsub!(/^'(?=#{punct_class}\B)/o, '’') | |
+ str.gsub!(/^"(?=#{punct_class}\B)/o, '”') | |
# Special case for double sets of quotes, e.g.: | |
# <p>He said, "'Quoted' words in a larger quote."</p> | |
@@ -416,19 +416,19 @@ class RubyPants < String | |
dec_dashes = '–|—' | |
# 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‘') | |
# Single closing quotes: | |
- str.gsub!(/(#{close_class})'/, '\1’') | |
+ str.gsub!(/(#{close_class})'/o, '\1’') | |
str.gsub!(/'(\s|s\b|$)/, '’\1') | |
# Any remaining single quotes should be opening ones: | |
str.gsub!(/'/, '‘') | |
# 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“') | |
# Double closing quotes: | |
- str.gsub!(/(#{close_class})"/, '\1”') | |
+ str.gsub!(/(#{close_class})"/o, '\1”') | |
str.gsub!(/"(\s|s\b|$)/, '”\1') | |
# Any remaining quotes should be opening ones: | |
str.gsub!(/"/, '“') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment