Skip to content

Commit

Permalink
Merge pull request #295 from jbrains/master
Browse files Browse the repository at this point in the history
Capitalize word after '!' and '?'.
  • Loading branch information
fhemberger committed Dec 10, 2011
2 parents 7f3ad1c + 343e0f1 commit cb61146
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/titlecase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit cb61146

Please sign in to comment.