Sha256: 910b94103a7a6efe0f204e8ac076d53e23b6c1ca5230cb334af1fd4be0b0625f
Contents?: true
Size: 798 Bytes
Versions: 2
Compression:
Stored size: 798 Bytes
Contents
module Typeright # Let's "quote" module Quotator def self.work(txt) txt .gsub(/(\W|^)"(\w)/, '\1“\2') # beginning " .gsub(/(“[^"]*)"([^"]*$|[^“"]*“)/, '\1”\2') # ending " .gsub(/([^0-9])"/, '\1”') # remaining " at end of word .gsub(/(\W|^)'(\S)/, '\1‘\2') # beginning ' .gsub(/([a-z])'([a-z])/i, '\1’\2') # conjunction's possession .gsub(/((‘[^']*)|[a-z])'([^0-9]|$)/i, '\1’\3') # ending ' .gsub(/(‘)([0-9]{2}[^’]*)(‘([^0-9]|$)|$|’[a-z])/i, '’\2\3') # abbrev. years like '93 .gsub(/(\B|^)‘(?=([^’]*’\b)*([^’‘]*\W[’‘]\b|[^’‘]*$))/i, '\1’') .gsub(/'''/, '‴') # triple prime .gsub(/("|'')/, '″') # double prime .tr("'", '′') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
typeright-0.0.5 | lib/typeright/quotator.rb |
typeright-0.0.3 | lib/typeright/quotator.rb |