@iebh/reflib 2.5.7 → 2.5.9
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/modules/endnoteXml.js +7 -0
- package/modules/ris.js +17 -0
- package/package.json +15 -14
package/modules/endnoteXml.js
CHANGED
|
@@ -85,6 +85,13 @@ export function readStream(stream) {
|
|
|
85
85
|
} else {
|
|
86
86
|
ref.keywords.push(xmlUnescape(text));
|
|
87
87
|
}
|
|
88
|
+
} else if (parentName == 'style' && gParentName == 'url') {
|
|
89
|
+
if (!ref.urls) ref.urls = [];
|
|
90
|
+
if (textAppend) {
|
|
91
|
+
ref.urls[ref.urls.length - 1] += xmlUnescape(text);
|
|
92
|
+
} else {
|
|
93
|
+
ref.urls.push(xmlUnescape(text));
|
|
94
|
+
}
|
|
88
95
|
} else if (parentName == 'style') { // Text within <style/> tag
|
|
89
96
|
if (textAppend || ref[gParentName]) { // Text already exists? Append (handles node-expats silly multi-text per escape character "feature")
|
|
90
97
|
ref[gParentName] += xmlUnescape(text);
|
package/modules/ris.js
CHANGED
|
@@ -9,6 +9,8 @@ import Emitter from '../shared/emitter.js';
|
|
|
9
9
|
* @param {Object} [options] Additional options to use when parsing
|
|
10
10
|
* @param {string} [options.defaultType='report'] Default citation type to assume when no other type is specified
|
|
11
11
|
* @param {string} [options.delimeter='\r'] How to split multi-line items
|
|
12
|
+
* @param {Boolean} [options.convertAbstract=true] If the `fallbackAbstract` field exists but not `abstract` use the former as the latter
|
|
13
|
+
* @param {Boolean} [options.convertCity=true] If the `fallbackCity` field exists but not `city` use the former as the latter
|
|
12
14
|
*
|
|
13
15
|
* @returns {Object} A readable stream analogue defined in `modules/interface.js`
|
|
14
16
|
*/
|
|
@@ -16,6 +18,8 @@ export function readStream(stream, options) {
|
|
|
16
18
|
let settings = {
|
|
17
19
|
defaultType: 'journalArticle',
|
|
18
20
|
delimeter: '\r',
|
|
21
|
+
convertAbtract: true,
|
|
22
|
+
convertCity: true,
|
|
19
23
|
...options,
|
|
20
24
|
};
|
|
21
25
|
|
|
@@ -132,6 +136,7 @@ export function writeStream(stream, options) {
|
|
|
132
136
|
*
|
|
133
137
|
* @param {string} refString Raw RIS string composing the start -> end of the ref
|
|
134
138
|
* @param {Object} settings Additional settings to pass, this should be initialized + parsed by the calling function for efficiency, see readStream() for full spec
|
|
139
|
+
* @param {Boolean} [settings.convertAbstract=true] If the `fallbackAbstract` field exists but not `abstract` use the former as the latter
|
|
135
140
|
* @returns {ReflibRef} The parsed reference
|
|
136
141
|
*/
|
|
137
142
|
export function parseRef(refString, settings) {
|
|
@@ -185,6 +190,18 @@ export function parseRef(refString, settings) {
|
|
|
185
190
|
delete ref._pageEnd;
|
|
186
191
|
}
|
|
187
192
|
// }}}
|
|
193
|
+
// FallbackAbstract -> Abstract (if the latter is missing) {{{
|
|
194
|
+
if ((settings.fallbackAbstract ?? true) && ref.fallbackAbstract && !ref.abstract) {
|
|
195
|
+
ref.abstract = ref.fallbackAbstract;
|
|
196
|
+
delete ref.fallbackAbstract;
|
|
197
|
+
}
|
|
198
|
+
// }}}
|
|
199
|
+
// FallbackCity -> City (if the latter is missing) {{{
|
|
200
|
+
if ((settings.fallbackCity ?? true) && ref.fallbackCity && !ref.abstract) {
|
|
201
|
+
ref.city = ref.fallbackCity;
|
|
202
|
+
delete ref.fallbackCity;
|
|
203
|
+
}
|
|
204
|
+
// }}}
|
|
188
205
|
|
|
189
206
|
return ref;
|
|
190
207
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iebh/reflib",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.9",
|
|
4
4
|
"description": "Reference / Citation reference library utilities",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"lint": "eslint
|
|
7
|
-
"test": "
|
|
6
|
+
"lint": "eslint",
|
|
7
|
+
"test": "testa",
|
|
8
8
|
"test:browser": "cd test/browser && npm run dev",
|
|
9
9
|
"test:watch": "nodemon --exec npm run test"
|
|
10
10
|
},
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
],
|
|
21
21
|
"author": "Matt Carter <m@ttcarter.com> (https://github.com/hash-bang)",
|
|
22
22
|
"contributors": [
|
|
23
|
-
"Connor Forbes <cforbes.software@gmail.com> (https://github.com/connorf25)"
|
|
23
|
+
"Connor Forbes <cforbes.software@gmail.com> (https://github.com/connorf25)",
|
|
24
|
+
"Irene Priya Jose (https://github.com/s5333384)",
|
|
25
|
+
"Tian Liang (https://github.com/Octian)"
|
|
24
26
|
],
|
|
25
27
|
"license": "MIT",
|
|
26
28
|
"bugs": {
|
|
@@ -44,22 +46,21 @@
|
|
|
44
46
|
"htmlparser2/lib/esm/WritableStream": "./modules/shims/WritableStream-browser.js",
|
|
45
47
|
"JSONStream": "./modules/shims/JSONStream-browser.js"
|
|
46
48
|
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@momsfriendlydevco/eslint-config": "^2.3.1",
|
|
49
|
-
"chai": "^5.2.0",
|
|
50
|
-
"eslint": "^9.31.0",
|
|
51
|
-
"mocha": "^11.1.0",
|
|
52
|
-
"mocha-logger": "^1.0.8",
|
|
53
|
-
"nodemon": "^3.1.9",
|
|
54
|
-
"temp": "^0.9.4",
|
|
55
|
-
"vite-plugin-replace": "^0.1.1"
|
|
56
|
-
},
|
|
57
49
|
"dependencies": {
|
|
58
50
|
"@iebh/cacx": "^1.0.3",
|
|
59
51
|
"@zip.js/zip.js": "^2.7.57",
|
|
60
52
|
"htmlparser2": "^9.1.0",
|
|
61
53
|
"JSONStream": "^1.3.5",
|
|
54
|
+
"lodash-es": "^4.17.22",
|
|
62
55
|
"mitt": "^3.0.1",
|
|
63
56
|
"sql.js": "^1.12.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@momsfriendlydevco/eslint-config": "^2.3.1",
|
|
60
|
+
"@momsfriendlydevco/testa": "^1.0.0",
|
|
61
|
+
"eslint": "^9.31.0",
|
|
62
|
+
"nodemon": "^3.1.9",
|
|
63
|
+
"temp": "^0.9.4",
|
|
64
|
+
"vite-plugin-replace": "^0.1.1"
|
|
64
65
|
}
|
|
65
66
|
}
|