aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ. B. Rainsberger <me@jbrains.ca>2011-11-28 00:24:20 +0100
committerJ. B. Rainsberger <me@jbrains.ca>2011-11-28 00:25:50 +0100
commit343e0f140949b9d7be2ab6a489c1edc662868463 (patch)
tree1791d8e9ee9d4dd728f9c309c895428f2136a404
parent76af6980d4e4f4ec4d5f910c2f5b79b12087e4d5 (diff)
downloadmy_new_personal_website-343e0f140949b9d7be2ab6a489c1edc662868463.tar.xz
my_new_personal_website-343e0f140949b9d7be2ab6a489c1edc662868463.zip
Improved, I think, the Titlecase plugin
-rw-r--r--plugins/titlecase.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/titlecase.rb b/plugins/titlecase.rb
index 3ad39b1f..7648932c 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!