Created
October 5, 2010 14:16
-
-
Save tomasc/611627 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
def three_periods_to_ellipsis | |
self.gsub("...", "…") | |
end | |
def straight_double_quotes_to_smart_double_quotes | |
self.gsub(/\B"\b([^"“”„‟″‶\r\n]+)\b"\B/, '“\1”') | |
end | |
def straight_single_quotes_to_smart_single_quotes | |
self.gsub(/\B'\b([^'‘’‚‛′‵\r\n]+)\b'\B/, '‘\1’') | |
end | |
def straight_apostrophes_to_smart_apostrophes | |
self.gsub(/\b'\b/, '’'); | |
end | |
def two_dashes_to_endash | |
self.gsub("--", "–") | |
end | |
def three_dashes_to_emdash | |
self.gsub("---", "—") | |
end | |
def endash_range | |
self.gsub(/(\d)(\s*-\s*)(\d)/, '\1–\3') | |
end | |
def emdash_between_words | |
self.gsub(/\b( +- +)\b/, ' — ') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment