@retorquere/bibtex-parser 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/sentence-case.js +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retorquere/bibtex-parser",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"description": "BibTeX parser",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "./index.d.ts",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"author": "Emiliano Heyns",
|
|
38
38
|
"license": "ISC",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@microsoft/api-documenter": "^7.22.
|
|
41
|
-
"@microsoft/api-extractor": "^7.36.
|
|
42
|
-
"@types/node": "^20.4.
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
44
|
-
"@typescript-eslint/parser": "^6.
|
|
40
|
+
"@microsoft/api-documenter": "^7.22.33",
|
|
41
|
+
"@microsoft/api-extractor": "^7.36.4",
|
|
42
|
+
"@types/node": "^20.4.9",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
|
44
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
45
45
|
"command-line-args": "^5.2.1",
|
|
46
46
|
"csv": "^6.3.1",
|
|
47
47
|
"digital-tree": "^2.0.4",
|
package/sentence-case.js
CHANGED
|
@@ -22,6 +22,8 @@ const re = {
|
|
|
22
22
|
// private aint = XRegExp("^\\p{L}n't(?=$|[\\P{L}])") // isn't
|
|
23
23
|
// private word = XRegExp('^\\p{L}+([-.]\\p{L}+)*') // also match gallium-nitride as one word
|
|
24
24
|
// private and = XRegExp('^\\p{Lu}&\\p{Lu}(?=$|[\\P{L}])') // Q&A
|
|
25
|
+
subSentenceStart: new RegExp(`([.?!][\\s]+)(<[^>]+>)?([${Lu}])`, 'g'),
|
|
26
|
+
sentenceStart: new RegExp(`^(<[^>]+>)?([${Lu}])`, 'g'),
|
|
25
27
|
};
|
|
26
28
|
function lowercase(word, allcaps) {
|
|
27
29
|
if (!word)
|
|
@@ -45,13 +47,13 @@ function lowercase(word, allcaps) {
|
|
|
45
47
|
function toSentenceCase(sentence, preserveQuoted = false) {
|
|
46
48
|
const allcaps = sentence === sentence.toUpperCase();
|
|
47
49
|
const preserve = [];
|
|
48
|
-
sentence.replace(
|
|
50
|
+
sentence.replace(re.subSentenceStart, (match, end, markup, char, i) => {
|
|
49
51
|
if (!sentence.substring(0, i + 1).match(re.acronym)) {
|
|
50
52
|
preserve.push({ pos: i + end.length + ((markup === null || markup === void 0 ? void 0 : markup.length) || 0), text: char, description: 'sub-sentence-start' });
|
|
51
53
|
}
|
|
52
54
|
return '';
|
|
53
55
|
});
|
|
54
|
-
sentence.replace(
|
|
56
|
+
sentence.replace(re.sentenceStart, (match, markup, char) => {
|
|
55
57
|
preserve.push({ pos: ((markup === null || markup === void 0 ? void 0 : markup.length) || 0), text: char, description: 'sentence-start' });
|
|
56
58
|
return '';
|
|
57
59
|
});
|