Merge pull request #473 from adam3smith/sentence-correct

some fixes to sentence case conversion.
This commit is contained in:
Dan Stillman 2014-04-26 01:59:09 -04:00
commit 39e7ca7c9e

View file

@ -1950,10 +1950,10 @@
break;
case 'sentence':
// capitalize the first letter, including after beginning punctuation
// capitalize after :, ?, ! and remove space(s) before those analogous to capitalizeTitle function
// also deal with initial punctuation here - open quotes and Spanish beginning quotation marks
newVal = val.toLowerCase();
newVal = newVal.replace(/(([:\?!]\s*|^)([\'\"¡¿“‘„«\s]+)?[^\s])/g, function (x) {
// capitalize after ?, ! and remove space(s) before those as well as colon analogous to capitalizeTitle function
// also deal with initial punctuation here - open quotes and Spanish beginning punctuation marks
newVal = val.toLowerCase().replace(/\s*:/, ":");
newVal = newVal.replace(/(([\?!]\s*|^)([\'\"¡¿“‘„«\s]+)?[^\s])/g, function (x) {
return x.replace(/\s+/m, " ").toUpperCase();});
break;
default: