Browse Source

Merge pull request #295 from jbrains/master

Capitalize word after '!' and '?'.
unreleased_contents
Frederic Hemberger 13 years ago
parent
commit
cb61146264
  1. 4
      plugins/titlecase.rb

4
plugins/titlecase.rb

@ -11,8 +11,8 @@ class String
# capitalize first and last words # capitalize first and last words
x.first.to_s.smart_capitalize! x.first.to_s.smart_capitalize!
x.last.to_s.smart_capitalize! x.last.to_s.smart_capitalize!
# small words after colons or periods are capitalized # small words are capitalized after colon, period, exclamation mark, question mark
x.join(" ").gsub(/(:|\.)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " } x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
end end
def titlecase! def titlecase!

Loading…
Cancel
Save