diff --git a/README.md b/README.md index 439ce2d..0a45bba 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,4 @@ Item utility functions require: Please bundle the [Zotero schema](https://github.com/zotero/zotero-schema) file with your repository, do not load it remotely. -To run tests: `npm i && npm test`. +To run tests: `git submodule update --init --recursive && npm i && npm test`. diff --git a/test/data/sentenceCase.json b/test/data/sentenceCase.json index af3a6e2..4e05fd6 100644 --- a/test/data/sentenceCase.json +++ b/test/data/sentenceCase.json @@ -1,6 +1,6 @@ { "IS THE SOLAR SYSTEM STABLE?": "Is the solar system stable?", - "Erratum: “Analyzing the Growth of InₓGa₁₋ₓN/GaN Superlattices in Self-Induced GaN Nanowires by x-Ray Diffraction”": "Erratum: “analyzing the growth of InₓGa₁₋ₓN/GaN superlattices in self-induced GaN nanowires by x-ray diffraction”", + "Erratum: “Analyzing the Growth of InₓGa₁₋ₓN/GaN Superlattices in Self-Induced GaN Nanowires by x-Ray Diffraction”": "Erratum: “Analyzing the growth of InₓGa₁₋ₓN/GaN superlattices in self-induced GaN nanowires by x-ray diffraction”", "Erratum: Analyzing the Growth of InxGa1xN/GaN Superlattices in Self-Induced GaN Nanowires by X-Ray Diffraction": "Erratum: analyzing the growth of InxGa1xN/GaN superlattices in self-induced GaN nanowires by X-ray diffraction", "Chapter 3. Putting Ideas into Your Own Words and Paragraphs": "Chapter 3. Putting ideas into your own words and paragraphs", "Structured Interviewing for OCB: Construct Validity, Faking, and the Effects of Question Type": "Structured interviewing for OCB: construct validity, faking, and the effects of question type", diff --git a/utilities.js b/utilities.js index b54aaf0..30d2559 100644 --- a/utilities.js +++ b/utilities.js @@ -131,9 +131,9 @@ var Utilities = { }); // protect leading capital - text.replace(/^(<[^>]+>)?([\p{Lu}])/u, (match, markup, char) => { - markup = markup || ""; - preserve.push({ start: markup.length, end: markup.length + char.length }); + text.replace(/(^|[“"])(<[^>]+>)?([\p{Lu}])/gu, (match, prefix, markup, char, offset) => { + markup = markup || '' + preserve.push({ start: offset + prefix.length + markup.length, end: offset + prefix.length + markup.length + char.length }); }); // protect nocase