@iebh/reflib 2.6.4 → 2.6.5
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/bibtex.js +7 -5
- package/package.json +1 -1
package/modules/bibtex.js
CHANGED
|
@@ -4,10 +4,12 @@ import Emitter from '../shared/emitter.js';
|
|
|
4
4
|
* Example: "Roomruangwong2020"
|
|
5
5
|
*/
|
|
6
6
|
function generateCitationKey(ref) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
let authorLastName = 'Anon';
|
|
8
|
+
if (Array.isArray(ref.authors) && ref.authors.length > 0) {
|
|
9
|
+
authorLastName = ref.authors[0].split(',')[0].trim();
|
|
10
|
+
}
|
|
11
|
+
let year = ref.year || 'n.d.'; // fallback if no year
|
|
12
|
+
return `${authorLastName}${year}`;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Lookup enum for the current parser mode we are in
|
|
@@ -217,7 +219,7 @@ export function writeStream(stream, options) {
|
|
|
217
219
|
defaultType: 'Misc',
|
|
218
220
|
delimeter: '\n',
|
|
219
221
|
omitUnkown: false,
|
|
220
|
-
omitFields: new Set(['
|
|
222
|
+
omitFields: new Set(['recNumber', 'type']),
|
|
221
223
|
recNumberRNPrefix: true,
|
|
222
224
|
recNumberKey: true,
|
|
223
225
|
...options,
|