Sha256: 63c22a395ca6167c4fbbd504a17fa91dad73f41e05a384f9d0d7470291cf38a8
Contents?: true
Size: 605 Bytes
Versions: 4
Compression:
Stored size: 605 Bytes
Contents
module ImproveTypography module Processors class Nbsp < Processor def call return str unless str.match?(/(\A|\s+)(\S|\d+)([\.?!]?)(\s+|\z)/) str .gsub(/(\s+)(\S|\d+|\S\.)(\s+)(\S)/, '\1\2 \4') # in the middle of string .gsub(/\A(\w|\d+|\w\.)(\s+)(\S)/, '\1 \3') # at the beginning of string .gsub(/([^\S\n])(\S|\d+|\S\.)(\z|[\.?!]\z|[\.?!]\s)/, ' \2\3') # at the end of string!! .gsub(/(\A|\s+)(©)(\s+)(\d+)/, '\1\2 \4') .gsub(/(\A|\s+)(No\.|Vol\.)(\s+)(\d+)/, '\1\2 \3') end end end end
Version data entries
4 entries across 4 versions & 1 rubygems