From d85d1e3108a7e9c7f83fc56cd9281592ed889be1 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Fri, 19 Aug 2016 11:24:15 -0700 Subject: [PATCH] Don't uppercase contractions. It seems that the first letter after of a contraction, after the apostrophe, gets capitalized. This is a simple fix an provides a location for future contractions as they are discovered. --- titlecase.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/titlecase.php b/titlecase.php index b2929e0..b9ab175 100644 --- a/titlecase.php +++ b/titlecase.php @@ -25,7 +25,8 @@ function titleCase ($title) { //(never on the first word, and never if preceded by a colon) $m = $i>0 && mb_substr ($title, max (0, $i-2), 1, 'UTF-8') !== ':' && !preg_match ('/[\x{2014}\x{2013}] ?/u', mb_substr ($title, max (0, $i-2), 2, 'UTF-8')) && - preg_match ('/^(a(nd?|s|t)?|b(ut|y)|en|for|i[fn]|o[fnr]|t(he|o)|vs?\.?|via)[ \-]/i', $m) + preg_match ('/^(a(nd?|s|t)?|b(ut|y)|en|for|i[fn]|o[fnr]|t(he|o)|vs?\.?|via)[ \-]/i', $m) || + preg_match( '/\'(s|t|ll|re|ve|d|m|em)/i', $m ) // Don't capitalize contractions ? //…and convert them to lowercase mb_strtolower ($m, 'UTF-8') @@ -56,4 +57,4 @@ function titleCase ($title) { return $title; } -?> \ No newline at end of file +?>