From 343e0f140949b9d7be2ab6a489c1edc662868463 Mon Sep 17 00:00:00 2001
From: "J. B. Rainsberger" <me@jbrains.ca>
Date: Mon, 28 Nov 2011 00:24:20 +0100
Subject: [PATCH] Improved, I think, the Titlecase plugin

---
 plugins/titlecase.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/titlecase.rb b/plugins/titlecase.rb
index 3ad39b1..7648932 100644
--- a/plugins/titlecase.rb
+++ b/plugins/titlecase.rb
@@ -11,8 +11,8 @@ class String
     # 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!