cite-proc had a problem "counting" words in a string when looking for capitalization of them.
The rule that it tried to model is: "Capitalize all words if they are not a stopword or if they are the first word".
What cite-proc actually did: "Capitalize all words if they are not a stopword or if they are the first lower letter word."
This PR changes the regex to match not only words starting with a lower letter but matching all words. This way the code can determine the first word correctly - also moves the "lower letter" check that was in the surrounding regex into it's separate check inside of the gsub! block.
Coverage increased (+0.04%) to 94.413% when pulling 99f0ae88976266a9ca065239af91b7d6a127e275 on easybiblabs:t/stopwords into 8708c7bc0810c1f9d5a74f9d10599e3b8ed06138 on inukshuk:master.
@inukshuk There are two more to come in a second, right now preparing those - also, credit goes totally to @walski, I am just doing the github pr organisation here since he is out for the week =)
cite-proc had a problem "counting" words in a string when looking for capitalization of them.
The rule that it tried to model is: "Capitalize all words if they are not a stopword or if they are the first word".
What cite-proc actually did: "Capitalize all words if they are not a stopword or if they are the first lower letter word."
This PR changes the regex to match not only words starting with a lower letter but matching all words. This way the code can determine the first word correctly - also moves the "lower letter" check that was in the surrounding regex into it's separate check inside of the gsub! block.