Skip to content
Browse files

Improved, I think, the Titlecase plugin

  • Loading branch information...
1 parent 76af698 commit 343e0f140949b9d7be2ab6a489c1edc662868463 @jbrains jbrains committed Nov 28, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 plugins/titlecase.rb
View
4 plugins/titlecase.rb
@@ -11,8 +11,8 @@ def titlecase
# capitalize first and last words
x.first.to_s.smart_capitalize!
x.last.to_s.smart_capitalize!
- # small words after colons or periods are capitalized
- x.join(" ").gsub(/(:|\.)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
+ # 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} " }
end
def titlecase!

0 comments on commit 343e0f1

Please sign in to comment.
Something went wrong with that request. Please try again.