mirror of
https://github.com/kremalicious/blog.git
synced 2024-12-23 01:30:01 +01:00
fix titlecase
This commit is contained in:
parent
00372c20bb
commit
f9157689bf
@ -9,8 +9,8 @@ class String
|
||||
word
|
||||
end
|
||||
# capitalize first and last words
|
||||
#x.first.to_s.smart_capitalize!
|
||||
#x.last.to_s.smart_capitalize!
|
||||
x.first.to_s.smart_capitalize!
|
||||
x.last.to_s.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
|
||||
|
Loading…
Reference in New Issue
Block a user