react-cheminfo 0.140.1 → 0.141.0
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/README.md +14 -8
- package/lib/citation/core/citationMarkup.d.ts +14 -0
- package/lib/citation/core/citationMarkup.d.ts.map +1 -0
- package/lib/citation/core/citationMarkup.js +27 -0
- package/lib/citation/core/citationMarkup.js.map +1 -0
- package/lib/citation/core/clipboard.d.ts +7 -6
- package/lib/citation/core/clipboard.d.ts.map +1 -1
- package/lib/citation/core/clipboard.js +19 -14
- package/lib/citation/core/clipboard.js.map +1 -1
- package/lib/citation/core/download.d.ts +4 -2
- package/lib/citation/core/download.d.ts.map +1 -1
- package/lib/citation/core/download.js +5 -3
- package/lib/citation/core/download.js.map +1 -1
- package/lib/citation/core/formats.d.ts +14 -3
- package/lib/citation/core/formats.d.ts.map +1 -1
- package/lib/citation/core/formats.js +31 -13
- package/lib/citation/core/formats.js.map +1 -1
- package/lib/citation/core/index.d.ts +3 -3
- package/lib/citation/core/index.d.ts.map +1 -1
- package/lib/citation/core/index.js +2 -2
- package/lib/citation/core/index.js.map +1 -1
- package/lib/citation/core/reference.d.ts +15 -0
- package/lib/citation/core/reference.d.ts.map +1 -1
- package/lib/citation/core/reference.js +24 -0
- package/lib/citation/core/reference.js.map +1 -1
- package/lib/citation/core/styles.d.ts +35 -0
- package/lib/citation/core/styles.d.ts.map +1 -0
- package/lib/citation/core/styles.js +21 -0
- package/lib/citation/core/styles.js.map +1 -0
- package/lib/citation/core/works.d.ts +2 -3
- package/lib/citation/core/works.d.ts.map +1 -1
- package/lib/citation/core/works.js +5 -6
- package/lib/citation/core/works.js.map +1 -1
- package/lib/citation/ui/CitationHtml.d.ts +13 -0
- package/lib/citation/ui/CitationHtml.d.ts.map +1 -0
- package/lib/citation/ui/CitationHtml.js +42 -0
- package/lib/citation/ui/CitationHtml.js.map +1 -0
- package/lib/citation/ui/CitationPreview.d.ts +7 -4
- package/lib/citation/ui/CitationPreview.d.ts.map +1 -1
- package/lib/citation/ui/CitationPreview.js +17 -21
- package/lib/citation/ui/CitationPreview.js.map +1 -1
- package/lib/citation/ui/CopyFormatEntries.js +1 -1
- package/lib/citation/ui/CopyFormatEntries.js.map +1 -1
- package/lib/citation/ui/entries.d.ts +1 -1
- package/lib/citation/ui/entries.d.ts.map +1 -1
- package/lib/citation/ui/entries.js +1 -1
- package/lib/citation/ui/entries.js.map +1 -1
- package/lib/citation/ui/useCopyFeedback.d.ts +1 -2
- package/lib/citation/ui/useCopyFeedback.d.ts.map +1 -1
- package/lib/citation/ui/useCopyFeedback.js.map +1 -1
- package/lib/credits/core/credits.d.ts +13 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +17 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/csl/core/cslItems.d.ts +97 -0
- package/lib/csl/core/cslItems.d.ts.map +1 -0
- package/lib/csl/core/cslItems.js +166 -0
- package/lib/csl/core/cslItems.js.map +1 -0
- package/lib/csl/core/cslStyles.d.ts +30 -0
- package/lib/csl/core/cslStyles.d.ts.map +1 -0
- package/lib/csl/core/cslStyles.js +48 -0
- package/lib/csl/core/cslStyles.js.map +1 -0
- package/lib/csl/core/formatCsl.d.ts +35 -0
- package/lib/csl/core/formatCsl.d.ts.map +1 -0
- package/lib/csl/core/formatCsl.js +100 -0
- package/lib/csl/core/formatCsl.js.map +1 -0
- package/lib/csl/core/referenceItem.d.ts +14 -0
- package/lib/csl/core/referenceItem.d.ts.map +1 -0
- package/lib/csl/core/referenceItem.js +60 -0
- package/lib/csl/core/referenceItem.js.map +1 -0
- package/lib/csl/core/styles/americanChemicalSociety.d.ts +8 -0
- package/lib/csl/core/styles/americanChemicalSociety.d.ts.map +1 -0
- package/lib/csl/core/styles/americanChemicalSociety.js +311 -0
- package/lib/csl/core/styles/americanChemicalSociety.js.map +1 -0
- package/lib/csl/core/styles/americanInstituteOfPhysics.d.ts +8 -0
- package/lib/csl/core/styles/americanInstituteOfPhysics.d.ts.map +1 -0
- package/lib/csl/core/styles/americanInstituteOfPhysics.js +172 -0
- package/lib/csl/core/styles/americanInstituteOfPhysics.js.map +1 -0
- package/lib/csl/core/styles/americanMathematicalSocietyNumeric.d.ts +8 -0
- package/lib/csl/core/styles/americanMathematicalSocietyNumeric.d.ts.map +1 -0
- package/lib/csl/core/styles/americanMathematicalSocietyNumeric.js +174 -0
- package/lib/csl/core/styles/americanMathematicalSocietyNumeric.js.map +1 -0
- package/lib/csl/core/styles/americanPhysicsSociety.d.ts +8 -0
- package/lib/csl/core/styles/americanPhysicsSociety.d.ts.map +1 -0
- package/lib/csl/core/styles/americanPhysicsSociety.js +227 -0
- package/lib/csl/core/styles/americanPhysicsSociety.js.map +1 -0
- package/lib/csl/core/styles/angewandteChemie.d.ts +8 -0
- package/lib/csl/core/styles/angewandteChemie.d.ts.map +1 -0
- package/lib/csl/core/styles/angewandteChemie.js +187 -0
- package/lib/csl/core/styles/angewandteChemie.js.map +1 -0
- package/lib/csl/core/styles/beilsteinJournalOfOrganicChemistry.d.ts +8 -0
- package/lib/csl/core/styles/beilsteinJournalOfOrganicChemistry.d.ts.map +1 -0
- package/lib/csl/core/styles/beilsteinJournalOfOrganicChemistry.js +280 -0
- package/lib/csl/core/styles/beilsteinJournalOfOrganicChemistry.js.map +1 -0
- package/lib/csl/core/styles/elsevierWithTitles.d.ts +8 -0
- package/lib/csl/core/styles/elsevierWithTitles.d.ts.map +1 -0
- package/lib/csl/core/styles/elsevierWithTitles.js +156 -0
- package/lib/csl/core/styles/elsevierWithTitles.js.map +1 -0
- package/lib/csl/core/styles/helveticaChimicaActa.d.ts +8 -0
- package/lib/csl/core/styles/helveticaChimicaActa.d.ts.map +1 -0
- package/lib/csl/core/styles/helveticaChimicaActa.js +189 -0
- package/lib/csl/core/styles/helveticaChimicaActa.js.map +1 -0
- package/lib/csl/core/styles/ieee.d.ts +8 -0
- package/lib/csl/core/styles/ieee.d.ts.map +1 -0
- package/lib/csl/core/styles/ieee.js +527 -0
- package/lib/csl/core/styles/ieee.js.map +1 -0
- package/lib/csl/core/styles/instituteOfPhysicsNumeric.d.ts +8 -0
- package/lib/csl/core/styles/instituteOfPhysicsNumeric.d.ts.map +1 -0
- package/lib/csl/core/styles/instituteOfPhysicsNumeric.js +135 -0
- package/lib/csl/core/styles/instituteOfPhysicsNumeric.js.map +1 -0
- package/lib/csl/core/styles/localeEnUs.d.ts +8 -0
- package/lib/csl/core/styles/localeEnUs.d.ts.map +1 -0
- package/lib/csl/core/styles/localeEnUs.js +872 -0
- package/lib/csl/core/styles/localeEnUs.js.map +1 -0
- package/lib/csl/core/styles/nature.d.ts +8 -0
- package/lib/csl/core/styles/nature.d.ts.map +1 -0
- package/lib/csl/core/styles/nature.js +197 -0
- package/lib/csl/core/styles/nature.js.map +1 -0
- package/lib/csl/core/styles/royalSocietyOfChemistry.d.ts +8 -0
- package/lib/csl/core/styles/royalSocietyOfChemistry.d.ts.map +1 -0
- package/lib/csl/core/styles/royalSocietyOfChemistry.js +267 -0
- package/lib/csl/core/styles/royalSocietyOfChemistry.js.map +1 -0
- package/lib/csl/core/styles/springerMathphysBrackets.d.ts +8 -0
- package/lib/csl/core/styles/springerMathphysBrackets.d.ts.map +1 -0
- package/lib/csl/core/styles/springerMathphysBrackets.js +159 -0
- package/lib/csl/core/styles/springerMathphysBrackets.js.map +1 -0
- package/lib/csl/core/styles/springerPhysicsBrackets.d.ts +8 -0
- package/lib/csl/core/styles/springerPhysicsBrackets.d.ts.map +1 -0
- package/lib/csl/core/styles/springerPhysicsBrackets.js +166 -0
- package/lib/csl/core/styles/springerPhysicsBrackets.js.map +1 -0
- package/lib/csl/core/styles/styleLoaders.d.ts +6 -0
- package/lib/csl/core/styles/styleLoaders.d.ts.map +1 -0
- package/lib/csl/core/styles/styleLoaders.js +23 -0
- package/lib/csl/core/styles/styleLoaders.js.map +1 -0
- package/lib/csl/core/styles/synthesis.d.ts +8 -0
- package/lib/csl/core/styles/synthesis.d.ts.map +1 -0
- package/lib/csl/core/styles/synthesis.js +196 -0
- package/lib/csl/core/styles/synthesis.js.map +1 -0
- package/lib/csl/core/styles/tetrahedron.d.ts +8 -0
- package/lib/csl/core/styles/tetrahedron.d.ts.map +1 -0
- package/lib/csl/core/styles/tetrahedron.js +22 -0
- package/lib/csl/core/styles/tetrahedron.js.map +1 -0
- package/lib/csl.d.ts +17 -0
- package/lib/csl.d.ts.map +1 -0
- package/lib/csl.js +15 -0
- package/lib/csl.js.map +1 -0
- package/package.json +3 -1
- package/src/citation/core/citationMarkup.ts +28 -0
- package/src/citation/core/clipboard.ts +26 -17
- package/src/citation/core/download.ts +7 -5
- package/src/citation/core/formats.ts +41 -16
- package/src/citation/core/index.ts +3 -6
- package/src/citation/core/reference.ts +25 -0
- package/src/citation/core/styles.ts +34 -0
- package/src/citation/core/works.ts +7 -9
- package/src/citation/ui/CitationHtml.tsx +42 -0
- package/src/citation/ui/CitationPreview.tsx +36 -35
- package/src/citation/ui/CopyFormatEntries.tsx +1 -1
- package/src/citation/ui/entries.tsx +2 -2
- package/src/citation/ui/useCopyFeedback.ts +1 -2
- package/src/credits/core/credits.ts +17 -0
- package/src/csl/core/citeproc.d.ts +43 -0
- package/src/csl/core/cslItems.ts +208 -0
- package/src/csl/core/cslStyles.ts +52 -0
- package/src/csl/core/formatCsl.ts +135 -0
- package/src/csl/core/referenceItem.ts +75 -0
- package/src/csl/core/styles/americanChemicalSociety.ts +310 -0
- package/src/csl/core/styles/americanInstituteOfPhysics.ts +171 -0
- package/src/csl/core/styles/americanMathematicalSocietyNumeric.ts +173 -0
- package/src/csl/core/styles/americanPhysicsSociety.ts +226 -0
- package/src/csl/core/styles/angewandteChemie.ts +186 -0
- package/src/csl/core/styles/beilsteinJournalOfOrganicChemistry.ts +279 -0
- package/src/csl/core/styles/elsevierWithTitles.ts +155 -0
- package/src/csl/core/styles/helveticaChimicaActa.ts +188 -0
- package/src/csl/core/styles/ieee.ts +526 -0
- package/src/csl/core/styles/instituteOfPhysicsNumeric.ts +134 -0
- package/src/csl/core/styles/localeEnUs.ts +871 -0
- package/src/csl/core/styles/nature.ts +196 -0
- package/src/csl/core/styles/royalSocietyOfChemistry.ts +266 -0
- package/src/csl/core/styles/springerMathphysBrackets.ts +158 -0
- package/src/csl/core/styles/springerPhysicsBrackets.ts +165 -0
- package/src/csl/core/styles/styleLoaders.ts +38 -0
- package/src/csl/core/styles/synthesis.ts +195 -0
- package/src/csl/core/styles/tetrahedron.ts +21 -0
- package/src/csl.ts +31 -0
- package/lib/citation/core/render.d.ts +0 -21
- package/lib/citation/core/render.d.ts.map +0 -1
- package/lib/citation/core/render.js +0 -74
- package/lib/citation/core/render.js.map +0 -1
- package/lib/citation/core/segments.d.ts +0 -62
- package/lib/citation/core/segments.d.ts.map +0 -1
- package/lib/citation/core/segments.js +0 -210
- package/lib/citation/core/segments.js.map +0 -1
- package/src/citation/core/render.ts +0 -78
- package/src/citation/core/segments.ts +0 -254
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The works a document cites, as CSL JSON: the format Zotero copies and
|
|
3
|
+
* exports (Quick Copy set to CSL JSON, or Better BibTeX's Better CSL JSON),
|
|
4
|
+
* Mendeley exports and doi.org answers. A work is identified by its DOI when
|
|
5
|
+
* it has one, so the same paper copied twice from two libraries is cited as
|
|
6
|
+
* one reference.
|
|
7
|
+
*/
|
|
8
|
+
/** What weighs on a saved document without changing a reference. */
|
|
9
|
+
const DROPPED = new Set(['abstract']);
|
|
10
|
+
/**
|
|
11
|
+
* The works a text holds, when it is CSL JSON: one work, or a list of them.
|
|
12
|
+
* @param text - What was pasted, dropped or read from a file.
|
|
13
|
+
* @returns The works, each under its key; undefined for a text that is not
|
|
14
|
+
* CSL JSON or names no work.
|
|
15
|
+
*/
|
|
16
|
+
export function readCslText(text) {
|
|
17
|
+
const trimmed = text.trim();
|
|
18
|
+
if (!trimmed.startsWith('[') && !trimmed.startsWith('{'))
|
|
19
|
+
return undefined;
|
|
20
|
+
let value;
|
|
21
|
+
try {
|
|
22
|
+
value = JSON.parse(trimmed);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const items = readCslItems(value);
|
|
28
|
+
return items.length > 0 ? items : undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The works a value holds, trusted for nothing: an entry without a type is
|
|
32
|
+
* left out.
|
|
33
|
+
* @param value - Parsed CSL JSON, one work or a list of them.
|
|
34
|
+
* @returns The works, each under its key, the first of two copies kept.
|
|
35
|
+
*/
|
|
36
|
+
export function readCslItems(value) {
|
|
37
|
+
const entries = Array.isArray(value) ? value : [value];
|
|
38
|
+
const items = [];
|
|
39
|
+
const seen = new Set();
|
|
40
|
+
for (const entry of entries) {
|
|
41
|
+
const item = readCslItem(entry);
|
|
42
|
+
if (item === undefined || seen.has(item.id))
|
|
43
|
+
continue;
|
|
44
|
+
seen.add(item.id);
|
|
45
|
+
items.push(item);
|
|
46
|
+
}
|
|
47
|
+
return items;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One work, under the key it is cited by.
|
|
51
|
+
* @param value - A parsed CSL JSON object.
|
|
52
|
+
* @returns The work, or undefined when it is not one.
|
|
53
|
+
*/
|
|
54
|
+
export function readCslItem(value) {
|
|
55
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const record = value;
|
|
59
|
+
if (typeof record.type !== 'string' || record.type === '')
|
|
60
|
+
return undefined;
|
|
61
|
+
const key = keyOf(record);
|
|
62
|
+
if (key === undefined)
|
|
63
|
+
return undefined;
|
|
64
|
+
const item = {};
|
|
65
|
+
for (const [variable, content] of Object.entries(record)) {
|
|
66
|
+
if (!DROPPED.has(variable))
|
|
67
|
+
item[variable] = content;
|
|
68
|
+
}
|
|
69
|
+
item.id = key;
|
|
70
|
+
return item;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* How a work is named in a menu: its first author and the year,
|
|
74
|
+
* `Patiny & Borel 2013`, `Patiny et al. 2024`.
|
|
75
|
+
* @param item - The work.
|
|
76
|
+
* @returns The name.
|
|
77
|
+
*/
|
|
78
|
+
export function itemLabel(item) {
|
|
79
|
+
const names = (item.author ?? item.editor ?? []).map(nameOf);
|
|
80
|
+
const year = itemYear(item);
|
|
81
|
+
let who = names[0] ?? '';
|
|
82
|
+
if (names.length === 2)
|
|
83
|
+
who = `${who} & ${names[1] ?? ''}`;
|
|
84
|
+
else if (names.length > 2)
|
|
85
|
+
who = `${who} et al.`;
|
|
86
|
+
if (who === '')
|
|
87
|
+
who = item.title ?? item.id;
|
|
88
|
+
return year === undefined ? who : `${who} ${year}`;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Where a work was published, as a menu writes it beside its title: the
|
|
92
|
+
* journal's abbreviation, else its name, with the volume.
|
|
93
|
+
* @param item - The work.
|
|
94
|
+
* @returns `J. Chem. Inf. Model. 53`, or an empty string.
|
|
95
|
+
*/
|
|
96
|
+
export function itemVenue(item) {
|
|
97
|
+
// Zotero copies the abbreviation under a name of its own.
|
|
98
|
+
const venue = textVariable(item, 'container-title-short') ||
|
|
99
|
+
stringOf(item.journalAbbreviation) ||
|
|
100
|
+
textVariable(item, 'container-title');
|
|
101
|
+
return [venue, item.volume ?? ''].filter(Boolean).join(' ');
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The year a work was published.
|
|
105
|
+
* @param item - The work.
|
|
106
|
+
* @returns The year, or undefined when the work gives none.
|
|
107
|
+
*/
|
|
108
|
+
export function itemYear(item) {
|
|
109
|
+
const year = Number(firstOf(firstOf(item.issued?.['date-parts'])));
|
|
110
|
+
if (Number.isInteger(year) && year > 0)
|
|
111
|
+
return year;
|
|
112
|
+
const written = /\b(?<year>\d{4})\b/.exec(item.issued?.literal ?? item.issued?.raw ?? '');
|
|
113
|
+
return written?.groups ? Number(written.groups.year) : undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Everything a search reads a work by: its authors, year, title, journal,
|
|
117
|
+
* DOI and the key a library gave it.
|
|
118
|
+
* @param item - The work.
|
|
119
|
+
* @returns The words, in lower case.
|
|
120
|
+
*/
|
|
121
|
+
export function itemSearchText(item) {
|
|
122
|
+
const names = (item.author ?? []).map((name) => `${name.family ?? ''} ${name.given ?? ''} ${name.literal ?? ''}`);
|
|
123
|
+
const words = [
|
|
124
|
+
...names,
|
|
125
|
+
String(itemYear(item) ?? ''),
|
|
126
|
+
item.title ?? '',
|
|
127
|
+
textVariable(item, 'container-title'),
|
|
128
|
+
textVariable(item, 'container-title-short'),
|
|
129
|
+
stringOf(item.journalAbbreviation),
|
|
130
|
+
item.DOI ?? '',
|
|
131
|
+
stringOf(item['citation-key']),
|
|
132
|
+
item.id,
|
|
133
|
+
];
|
|
134
|
+
return words.join(' ').toLowerCase();
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A variable of a work that is text, `container-title` and the others named
|
|
138
|
+
* with a hyphen.
|
|
139
|
+
* @param item - The work.
|
|
140
|
+
* @param variable - The variable's name.
|
|
141
|
+
* @returns Its text; empty when the work has none.
|
|
142
|
+
*/
|
|
143
|
+
export function textVariable(item, variable) {
|
|
144
|
+
return stringOf(item[variable]);
|
|
145
|
+
}
|
|
146
|
+
function firstOf(value) {
|
|
147
|
+
return Array.isArray(value) ? value[0] : undefined;
|
|
148
|
+
}
|
|
149
|
+
function nameOf(name) {
|
|
150
|
+
return name.family ?? name.literal ?? name.given ?? '';
|
|
151
|
+
}
|
|
152
|
+
// A DOI is the same in every library; any other key only in the one that made
|
|
153
|
+
// it.
|
|
154
|
+
function keyOf(record) {
|
|
155
|
+
const doi = stringOf(record.DOI).trim().toLowerCase();
|
|
156
|
+
if (doi !== '')
|
|
157
|
+
return `doi:${doi}`;
|
|
158
|
+
const key = stringOf(record['citation-key']) || stringOf(record.id);
|
|
159
|
+
return key === '' ? undefined : key;
|
|
160
|
+
}
|
|
161
|
+
function stringOf(value) {
|
|
162
|
+
if (typeof value === 'string')
|
|
163
|
+
return value;
|
|
164
|
+
return typeof value === 'number' ? String(value) : '';
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=cslItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cslItems.js","sourceRoot":"","sources":["../../../src/csl/core/cslItems.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuCH,oEAAoE;AACpE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3E,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,M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AED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;AAED,SAAS,MAAM,CAAC,IAAa;IAC3B,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;AACzD,CAAC;AAED,8EAA8E;AAC9E,MAAM;AACN,SAAS,KAAK,CAAC,MAA+B;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,OAAO,GAAG,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpE,OAAO,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;AACtC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Citation Style Language styles the journals of the family format their
|
|
3
|
+
* references in, kept as the CSL project publishes them (each says who wrote
|
|
4
|
+
* it and under which licence) and loaded one at a time, only when something is
|
|
5
|
+
* formatted. A dependent style — Tetrahedron's — is formatted by the style it
|
|
6
|
+
* names as its parent. `scripts/csl-styles.mjs` writes them.
|
|
7
|
+
*/
|
|
8
|
+
/** The ids of the styles there are, as the CSL project names them. */
|
|
9
|
+
export declare const CSL_STYLE_IDS: readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* Whether a style is one there is.
|
|
12
|
+
* @param id - The style's id, `american-chemical-society`.
|
|
13
|
+
* @returns True when it is.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasCslStyle(id: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The style that formats a style's references: itself, or the parent a
|
|
18
|
+
* dependent style names.
|
|
19
|
+
* @param id - The style's id, one there is.
|
|
20
|
+
* @returns Its XML.
|
|
21
|
+
* @throws {Error} For a style there is not.
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadCslStyle(id: string): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* The terms a style writes its references with — `et al.`, `p.`, the months —
|
|
26
|
+
* in English, the language every journal of the family publishes in.
|
|
27
|
+
* @returns The locale's XML.
|
|
28
|
+
*/
|
|
29
|
+
export declare function loadCslLocale(): Promise<string>;
|
|
30
|
+
//# sourceMappingURL=cslStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cslStyles.d.ts","sourceRoot":"","sources":["../../../src/csl/core/cslStyles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,sEAAsE;AACtE,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAA+B,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM9D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAE/C"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Citation Style Language styles the journals of the family format their
|
|
3
|
+
* references in, kept as the CSL project publishes them (each says who wrote
|
|
4
|
+
* it and under which licence) and loaded one at a time, only when something is
|
|
5
|
+
* formatted. A dependent style — Tetrahedron's — is formatted by the style it
|
|
6
|
+
* names as its parent. `scripts/csl-styles.mjs` writes them.
|
|
7
|
+
*/
|
|
8
|
+
import { STYLE_LOADERS } from "./styles/styleLoaders.js";
|
|
9
|
+
/** The ids of the styles there are, as the CSL project names them. */
|
|
10
|
+
export const CSL_STYLE_IDS = Object.keys(STYLE_LOADERS);
|
|
11
|
+
/**
|
|
12
|
+
* Whether a style is one there is.
|
|
13
|
+
* @param id - The style's id, `american-chemical-society`.
|
|
14
|
+
* @returns True when it is.
|
|
15
|
+
*/
|
|
16
|
+
export function hasCslStyle(id) {
|
|
17
|
+
return Object.hasOwn(STYLE_LOADERS, id);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The style that formats a style's references: itself, or the parent a
|
|
21
|
+
* dependent style names.
|
|
22
|
+
* @param id - The style's id, one there is.
|
|
23
|
+
* @returns Its XML.
|
|
24
|
+
* @throws {Error} For a style there is not.
|
|
25
|
+
*/
|
|
26
|
+
export async function loadCslStyle(id) {
|
|
27
|
+
const load = hasCslStyle(id) ? STYLE_LOADERS[id] : undefined;
|
|
28
|
+
if (load === undefined)
|
|
29
|
+
throw new Error(`unknown citation style: ${id}`);
|
|
30
|
+
const xml = await load();
|
|
31
|
+
const parent = parentOf(xml);
|
|
32
|
+
return parent === undefined || parent === id ? xml : loadCslStyle(parent);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The terms a style writes its references with — `et al.`, `p.`, the months —
|
|
36
|
+
* in English, the language every journal of the family publishes in.
|
|
37
|
+
* @returns The locale's XML.
|
|
38
|
+
*/
|
|
39
|
+
export function loadCslLocale() {
|
|
40
|
+
return import("./styles/localeEnUs.js").then((module) => module.LOCALE);
|
|
41
|
+
}
|
|
42
|
+
function parentOf(xml) {
|
|
43
|
+
const link = /<link\s[^>]*rel="independent-parent"[^>]*>/.exec(xml)?.[0];
|
|
44
|
+
return link === undefined
|
|
45
|
+
? undefined
|
|
46
|
+
: /href="[^"]*\/styles\/(?<parent>[^"/]+)"/.exec(link)?.groups?.parent;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=cslStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cslStyles.js","sourceRoot":"","sources":["../../../src/csl/core/cslStyles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,sEAAsE;AACtE,MAAM,CAAC,MAAM,aAAa,GAAsB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAU;IAC3C,MAAM,IAAI,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;IACzE,MAAM,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC3B,MAAM,IAAI,GAAG,4CAA4C,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzE,OAAO,IAAI,KAAK,SAAS;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,yCAAyC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Citations and reference lists formatted by citeproc-js — the processor
|
|
3
|
+
* Zotero runs — in a journal's CSL style: numbered in the order the works are
|
|
4
|
+
* first cited for a numeric style, by author and year for another, each
|
|
5
|
+
* citation as the style sets it, `<sup>1,2</sup>`, `[3]`, `(Patiny 2013)`. The
|
|
6
|
+
* processor and the style are loaded the first time anything is formatted.
|
|
7
|
+
*/
|
|
8
|
+
import type { CslItem } from './cslItems.ts';
|
|
9
|
+
/** A document's citations and reference list, as the style writes them. */
|
|
10
|
+
export interface FormattedCslCitations {
|
|
11
|
+
/** Each citation, in document order, as HTML; empty for one citing none. */
|
|
12
|
+
citations: string[];
|
|
13
|
+
/** Each entry of the reference list, in its order, as HTML. */
|
|
14
|
+
bibliography: string[];
|
|
15
|
+
}
|
|
16
|
+
/** What an entry is written as: HTML, or the text it reads. */
|
|
17
|
+
export type CslOutput = 'html' | 'text';
|
|
18
|
+
/**
|
|
19
|
+
* Format the citations of a document, and its reference list, in a style.
|
|
20
|
+
* @param clusters - The works each citation cites, citations in document
|
|
21
|
+
* order; a work cited twice is the same id both times.
|
|
22
|
+
* @param style - The id of the style, one there is.
|
|
23
|
+
* @returns The citations and the reference list, as HTML.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatCslCitations(clusters: ReadonlyArray<readonly CslItem[]>, style: string): Promise<FormattedCslCitations>;
|
|
26
|
+
/**
|
|
27
|
+
* Each work as the entry a reference list of the style gives it, without the
|
|
28
|
+
* number a numeric style puts before it: what a reader copies to cite one work.
|
|
29
|
+
* @param items - The works, each cited once, in this order.
|
|
30
|
+
* @param style - The id of the style, one there is.
|
|
31
|
+
* @param output - HTML, or plain text.
|
|
32
|
+
* @returns Each work's entry, in the order given.
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatCslEntries(items: readonly CslItem[], style: string, output: CslOutput): Promise<string[]>;
|
|
35
|
+
//# sourceMappingURL=formatCsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatCsl.d.ts","sourceRoot":"","sources":["../../../src/csl/core/formatCsl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,2EAA2E;AAC3E,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,aAAa,CAAC,SAAS,OAAO,EAAE,CAAC,EAC3C,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,qBAAqB,CAAC,CAiBhC;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,SAAS,OAAO,EAAE,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Citations and reference lists formatted by citeproc-js — the processor
|
|
3
|
+
* Zotero runs — in a journal's CSL style: numbered in the order the works are
|
|
4
|
+
* first cited for a numeric style, by author and year for another, each
|
|
5
|
+
* citation as the style sets it, `<sup>1,2</sup>`, `[3]`, `(Patiny 2013)`. The
|
|
6
|
+
* processor and the style are loaded the first time anything is formatted.
|
|
7
|
+
*/
|
|
8
|
+
import { unescapeXml } from "../../drawing/render/markup.js";
|
|
9
|
+
import { loadCslLocale, loadCslStyle } from "./cslStyles.js";
|
|
10
|
+
/**
|
|
11
|
+
* Format the citations of a document, and its reference list, in a style.
|
|
12
|
+
* @param clusters - The works each citation cites, citations in document
|
|
13
|
+
* order; a work cited twice is the same id both times.
|
|
14
|
+
* @param style - The id of the style, one there is.
|
|
15
|
+
* @returns The citations and the reference list, as HTML.
|
|
16
|
+
*/
|
|
17
|
+
export async function formatCslCitations(clusters, style) {
|
|
18
|
+
const cited = clusters.filter((cluster) => cluster.length > 0);
|
|
19
|
+
if (cited.length === 0) {
|
|
20
|
+
return { citations: clusters.map(() => ''), bibliography: [] };
|
|
21
|
+
}
|
|
22
|
+
const engine = await engineFor(cited.flat(), style);
|
|
23
|
+
const written = engine.rebuildProcessorState(citationsOf(cited), 'html');
|
|
24
|
+
const texts = written.map(([, , html]) => html);
|
|
25
|
+
let next = 0;
|
|
26
|
+
const citations = clusters.map((cluster) => cluster.length === 0 ? '' : (texts[next++] ?? ''));
|
|
27
|
+
const list = engine.makeBibliography();
|
|
28
|
+
return {
|
|
29
|
+
citations,
|
|
30
|
+
bibliography: list === false ? [] : list[1].map(compactEntry),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Each work as the entry a reference list of the style gives it, without the
|
|
35
|
+
* number a numeric style puts before it: what a reader copies to cite one work.
|
|
36
|
+
* @param items - The works, each cited once, in this order.
|
|
37
|
+
* @param style - The id of the style, one there is.
|
|
38
|
+
* @param output - HTML, or plain text.
|
|
39
|
+
* @returns Each work's entry, in the order given.
|
|
40
|
+
*/
|
|
41
|
+
export async function formatCslEntries(items, style, output) {
|
|
42
|
+
if (items.length === 0)
|
|
43
|
+
return [];
|
|
44
|
+
const engine = await engineFor(items, style);
|
|
45
|
+
engine.rebuildProcessorState(citationsOf(items.map((item) => [item])));
|
|
46
|
+
const list = engine.makeBibliography();
|
|
47
|
+
if (list === false)
|
|
48
|
+
return items.map(() => '');
|
|
49
|
+
const [parameters, entries] = list;
|
|
50
|
+
const ids = parameters.entry_ids;
|
|
51
|
+
const byId = new Map();
|
|
52
|
+
for (const [index, entry] of entries.entries()) {
|
|
53
|
+
const id = Array.isArray(ids) ? ids[index]?.[0] : undefined;
|
|
54
|
+
if (typeof id === 'string' || typeof id === 'number') {
|
|
55
|
+
byId.set(String(id), entryOf(entry, output));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return items.map((item) => byId.get(item.id) ?? '');
|
|
59
|
+
}
|
|
60
|
+
async function engineFor(items, style) {
|
|
61
|
+
const [{ default: CSL }, styleXml, locale] = await Promise.all([
|
|
62
|
+
import('citeproc'),
|
|
63
|
+
loadCslStyle(style),
|
|
64
|
+
loadCslLocale(),
|
|
65
|
+
]);
|
|
66
|
+
const works = new Map();
|
|
67
|
+
for (const item of items) {
|
|
68
|
+
// The processor writes into what it reads; the caller's copy stays.
|
|
69
|
+
if (!works.has(item.id))
|
|
70
|
+
works.set(item.id, structuredClone(item));
|
|
71
|
+
}
|
|
72
|
+
return new CSL.Engine({
|
|
73
|
+
retrieveLocale: () => locale,
|
|
74
|
+
retrieveItem: (id) => works.get(id),
|
|
75
|
+
}, styleXml, 'en-US', true);
|
|
76
|
+
}
|
|
77
|
+
function citationsOf(clusters) {
|
|
78
|
+
return clusters.map((cluster, index) => ({
|
|
79
|
+
citationID: `citation-${index}`,
|
|
80
|
+
citationItems: cluster.map(({ id }) => ({ id })),
|
|
81
|
+
properties: { noteIndex: 0 },
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
// The processor lays an entry's blocks out on lines of their own; a space
|
|
85
|
+
// between two words of the entry is never on a line break.
|
|
86
|
+
function compactEntry(entry) {
|
|
87
|
+
return entry.trim().replaceAll(/>\s*\n\s*</g, '><');
|
|
88
|
+
}
|
|
89
|
+
// An entry copied on its own has no place in a list to be numbered by, and
|
|
90
|
+
// its text is what its HTML reads.
|
|
91
|
+
function entryOf(entry, output) {
|
|
92
|
+
const html = compactEntry(entry)
|
|
93
|
+
.replace(/<div class="csl-left-margin">[^<]*<\/div>/, '')
|
|
94
|
+
.replace(/^<div class="csl-entry">(?<body>.*)<\/div>$/s, '$<body>')
|
|
95
|
+
.replace(/^<div class="csl-right-inline">(?<body>.*)<\/div>$/s, '$<body>');
|
|
96
|
+
return output === 'html'
|
|
97
|
+
? html
|
|
98
|
+
: unescapeXml(html.replaceAll(/<[^>]*>/g, ''));
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=formatCsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatCsl.js","sourceRoot":"","sources":["../../../src/csl/core/formatCsl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa7D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAA2C,EAC3C,KAAa;IAEb,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IACjE,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,KAAK,C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
2
|
+
* A work the family cites — its own papers, the datasets behind them — as the
|
|
3
|
+
* CSL JSON a style formats, under the key its DOI gives it, so it is the same
|
|
4
|
+
* work as the copy Zotero or doi.org would hand over.
|
|
5
|
+
*/
|
|
6
|
+
import type { Reference } from '../../citation/core/reference.ts';
|
|
7
|
+
import type { CslItem } from './cslItems.ts';
|
|
8
|
+
/**
|
|
9
|
+
* A reference as CSL JSON.
|
|
10
|
+
* @param reference - An article or a dataset.
|
|
11
|
+
* @returns The work, keyed `doi:<its DOI>`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function referenceToCsl(reference: Reference): CslItem;
|
|
14
|
+
//# sourceMappingURL=referenceItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceItem.d.ts","sourceRoot":"","sources":["../../../src/csl/core/referenceItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAGV,SAAS,EAEV,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,eAAe,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAI5D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A work the family cites — its own papers, the datasets behind them — as the
|
|
3
|
+
* CSL JSON a style formats, under the key its DOI gives it, so it is the same
|
|
4
|
+
* work as the copy Zotero or doi.org would hand over.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A reference as CSL JSON.
|
|
8
|
+
* @param reference - An article or a dataset.
|
|
9
|
+
* @returns The work, keyed `doi:<its DOI>`.
|
|
10
|
+
*/
|
|
11
|
+
export function referenceToCsl(reference) {
|
|
12
|
+
return reference.kind === 'dataset'
|
|
13
|
+
? datasetItem(reference)
|
|
14
|
+
: articleItem(reference);
|
|
15
|
+
}
|
|
16
|
+
function articleItem(reference) {
|
|
17
|
+
const { authors, title, journal, journalAbbreviation, year, volume } = reference;
|
|
18
|
+
const { issue, firstPage, lastPage, doi, publisher } = reference;
|
|
19
|
+
// An article number is one page, never a range from it to itself.
|
|
20
|
+
const page = lastPage === '' || lastPage === firstPage
|
|
21
|
+
? firstPage
|
|
22
|
+
: `${firstPage}-${lastPage}`;
|
|
23
|
+
return {
|
|
24
|
+
id: keyOf(doi),
|
|
25
|
+
type: 'article-journal',
|
|
26
|
+
title,
|
|
27
|
+
'container-title': journal,
|
|
28
|
+
'container-title-short': journalAbbreviation,
|
|
29
|
+
author: authors.map(nameOf),
|
|
30
|
+
issued: { 'date-parts': [[year]] },
|
|
31
|
+
volume,
|
|
32
|
+
...(issue === undefined ? {} : { issue }),
|
|
33
|
+
page,
|
|
34
|
+
publisher,
|
|
35
|
+
DOI: doi,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function datasetItem(reference) {
|
|
39
|
+
const { authors, title, repository, year, version, doi } = reference;
|
|
40
|
+
return {
|
|
41
|
+
id: keyOf(doi),
|
|
42
|
+
type: 'dataset',
|
|
43
|
+
title,
|
|
44
|
+
publisher: repository,
|
|
45
|
+
author: authors.map(nameOf),
|
|
46
|
+
issued: { 'date-parts': [[year]] },
|
|
47
|
+
...(version === undefined ? {} : { version }),
|
|
48
|
+
DOI: doi,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// An organisation has no given name, and is written whole.
|
|
52
|
+
function nameOf(author) {
|
|
53
|
+
return author.given === ''
|
|
54
|
+
? { literal: author.family }
|
|
55
|
+
: { family: author.family, given: author.given };
|
|
56
|
+
}
|
|
57
|
+
function keyOf(doi) {
|
|
58
|
+
return `doi:${doi.toLowerCase()}`;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=referenceItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceItem.js","sourceRoot":"","sources":["../../../src/csl/core/referenceItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH;;;;GA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C;QACd,IAAI,EAAE,SAAS;QACf,KAAK;QACL,SAAS,EAAE,UAAU;QACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;QAC3B,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;QAClC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC7C,GAAG,EAAE,GAAG;KACT,CAAC;AACJ,CAAC;AAED,2DAA2D;AAC3D,SAAS,MAAM,CAAC,MAAuB;IACrC,OAAO,MAAM,CAAC,KAAK,KAAK,EAAE;QACxB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;QAC5B,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AACrD,CAAC;AAED,SAAS,KAAK,CAAC,GAAW;IACxB,OAAO,OAAO,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CSL style `american-chemical-society`, as the Citation Style Language project publishes it
|
|
3
|
+
* (styles repository, commit 15ea57496883). Its `<rights>`
|
|
4
|
+
* element states its licence.
|
|
5
|
+
* Written by scripts/csl-styles.mjs: change the script, not this file.
|
|
6
|
+
*/
|
|
7
|
+
export declare const STYLE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<style xmlns=\"http://purl.org/net/xbiblio/csl\" class=\"in-text\" version=\"1.0\" demote-non-dropping-particle=\"sort-only\" page-range-format=\"expanded\" default-locale=\"en-US\">\n <info>\n <title>ACS Guide 2026 revision</title>\n <title-short>American Chemical Society</title-short>\n <id>https://www.zotero.org/styles/american-chemical-society</id>\n <link href=\"https://www.zotero.org/styles/american-chemical-society\" rel=\"self\"/>\n <link href=\"https://doi.org/10.1021/acsguide.40303\" rel=\"documentation\"/>\n <link href=\"https://doi.org/10.1021/acsguide\" rel=\"documentation\"/>\n <author>\n <name>Julian Onions</name>\n <email>julian.onions@gmail.com</email>\n </author>\n <contributor>\n <name>Ivan Bushmarinov</name>\n <email>ib@ineos.ac.ru</email>\n </contributor>\n <contributor>\n <name>Sebastian Karcher</name>\n </contributor>\n <contributor>\n <name>Patrick O'Brien</name>\n </contributor>\n <category citation-format=\"numeric\"/>\n <category field=\"chemistry\"/>\n <summary>The American Chemical Society style</summary>\n <updated>2026-08-25T12:37:10+00:00</updated>\n <rights license=\"https://creativecommons.org/licenses/by-sa/3.0/\">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>\n </info>\n <locale xml:lang=\"en\">\n <terms>\n <term name=\"editortranslator\" form=\"short\">\n <single>ed. and translator</single>\n <multiple>eds. and translators</multiple>\n </term>\n <term name=\"translator\" form=\"short\">\n <single>translator</single>\n <multiple>translators</multiple>\n </term>\n <term name=\"collection-editor\" form=\"short\">\n <single>series ed.</single>\n <multiple>series eds.</multiple>\n </term>\n </terms>\n </locale>\n <macro name=\"editor\">\n <group delimiter=\"; \">\n <names variable=\"editor translator\" delimiter=\"; \">\n <name sort-separator=\", \" initialize-with=\". \" name-as-sort-order=\"all\" delimiter=\", \" delimiter-precedes-last=\"always\"/>\n <label form=\"short\" prefix=\", \" text-case=\"title\"/>\n </names>\n <names variable=\"collection-editor\">\n <name sort-separator=\", \" initialize-with=\". \" name-as-sort-order=\"all\" delimiter=\", \" delimiter-precedes-last=\"always\"/>\n <label form=\"short\" prefix=\", \" text-case=\"title\"/>\n </names>\n </group>\n </macro>\n <macro name=\"author\">\n <names variable=\"author\">\n <name sort-separator=\", \" initialize-with=\". \" name-as-sort-order=\"all\" delimiter=\"; \" delimiter-precedes-last=\"always\"/>\n <label form=\"short\" prefix=\", \" text-case=\"capitalize-first\"/>\n </names>\n </macro>\n <macro name=\"publisher\">\n <choose>\n <if type=\"thesis\" match=\"any\">\n <text variable=\"publisher\"/>\n </if>\n <else>\n <group delimiter=\": \">\n <text variable=\"publisher\"/>\n <text variable=\"publisher-place\"/>\n </group>\n </else>\n </choose>\n </macro>\n <macro name=\"title\">\n <choose>\n <if type=\"bill book graphic legal_case legislation motion_picture report song\" match=\"any\">\n <text variable=\"title\" text-case=\"title\" font-style=\"italic\"/>\n </if>\n <else>\n <text variable=\"title\" text-case=\"title\"/>\n </else>\n </choose>\n </macro>\n <macro name=\"volume\">\n <group delimiter=\" \">\n <label variable=\"volume\" form=\"short\" text-case=\"capitalize-first\"/>\n <text variable=\"volume\"/>\n </group>\n </macro>\n <macro name=\"series\">\n <text variable=\"collection-title\"/>\n </macro>\n <macro name=\"pages\">\n <group delimiter=\" \">\n <label variable=\"page\" form=\"short\" strip-periods=\"true\"/>\n <text variable=\"page\"/>\n </group>\n </macro>\n <macro name=\"book-container\">\n <group delimiter=\". \">\n <text macro=\"title\"/>\n <choose>\n <if type=\"entry-dictionary entry-encyclopedia\" match=\"none\">\n <group delimiter=\" \">\n <text term=\"in\" text-case=\"capitalize-first\"/>\n <text variable=\"container-title\" font-style=\"italic\"/>\n </group>\n </if>\n <else>\n <text variable=\"container-title\" font-style=\"italic\"/>\n </else>\n </choose>\n </group>\n </macro>\n <macro name=\"issued\">\n <date variable=\"issued\" delimiter=\" \">\n <date-part name=\"year\"/>\n </date>\n </macro>\n <macro name=\"full-issued\">\n <date variable=\"issued\" delimiter=\" \">\n <date-part name=\"month\" form=\"long\" suffix=\" \"/>\n <date-part name=\"day\" suffix=\", \"/>\n <date-part name=\"year\"/>\n </date>\n </macro>\n <macro name=\"edition\">\n <choose>\n <if is-numeric=\"edition\">\n <group delimiter=\" \">\n <number variable=\"edition\" form=\"ordinal\"/>\n <text term=\"edition\" form=\"short\"/>\n </group>\n </if>\n <else>\n <text variable=\"edition\" suffix=\".\"/>\n </else>\n </choose>\n </macro>\n <macro name=\"access\">\n <choose>\n <if variable=\"DOI\" match=\"any\">\n <text variable=\"DOI\" prefix=\"https://doi.org/\"/>\n </if>\n <else-if type=\"article-journal book chapter entry-encyclopedia entry-dictionary paper-conference\" match=\"none\">\n <choose>\n <if variable=\"URL\">\n <group delimiter=\" \">\n <text variable=\"URL\"/>\n <group delimiter=\" \" prefix=\"(\" suffix=\")\">\n <text term=\"accessed\"/>\n <date variable=\"accessed\">\n <date-part name=\"year\"/>\n <date-part name=\"month\" prefix=\"-\" form=\"numeric-leading-zeros\"/>\n <date-part name=\"day\" prefix=\"-\" form=\"numeric-leading-zeros\"/>\n </date>\n </group>\n </group>\n </if>\n </choose>\n </else-if>\n </choose>\n </macro>\n <citation collapse=\"citation-number\">\n <sort>\n <key variable=\"citation-number\"/>\n </sort>\n <layout delimiter=\",\" vertical-align=\"sup\">\n <text variable=\"citation-number\"/>\n </layout>\n </citation>\n <bibliography second-field-align=\"flush\" entry-spacing=\"0\">\n <layout>\n <text variable=\"citation-number\" prefix=\"(\" suffix=\")\"/>\n <group delimiter=\". \" suffix=\".\">\n <text macro=\"author\"/>\n <choose>\n <if type=\"article-journal review\" match=\"any\">\n <group delimiter=\" \">\n <text macro=\"title\" suffix=\".\"/>\n <text variable=\"container-title\" font-style=\"italic\" form=\"short\"/>\n <group delimiter=\", \">\n <text macro=\"issued\" font-weight=\"bold\"/>\n <choose>\n <if variable=\"volume\">\n <group delimiter=\" \">\n <text variable=\"volume\" font-style=\"italic\"/>\n <text variable=\"issue\" prefix=\"(\" suffix=\")\"/>\n </group>\n </if>\n <else>\n <group delimiter=\" \">\n <text term=\"issue\" form=\"short\" text-case=\"capitalize-first\"/>\n <text variable=\"issue\"/>\n </group>\n </else>\n </choose>\n <text variable=\"page\"/>\n </group>\n </group>\n </if>\n <else-if type=\"article-magazine article-newspaper article\" match=\"any\">\n <group delimiter=\" \">\n <text macro=\"title\" suffix=\".\"/>\n <text variable=\"container-title\" font-style=\"italic\" suffix=\".\"/>\n <text macro=\"edition\"/>\n <text macro=\"publisher\"/>\n <group delimiter=\", \">\n <text macro=\"full-issued\"/>\n <text macro=\"pages\"/>\n </group>\n </group>\n </else-if>\n <else-if type=\"thesis\">\n <group delimiter=\", \">\n <group delimiter=\". \">\n <text macro=\"title\"/>\n <text variable=\"genre\"/>\n </group>\n <text macro=\"publisher\"/>\n <text macro=\"issued\"/>\n <text macro=\"volume\"/>\n <text macro=\"pages\"/>\n </group>\n </else-if>\n <else-if type=\"bill book graphic legal_case legislation motion_picture report song\" match=\"any\">\n <group delimiter=\"; \">\n <group delimiter=\", \">\n <text macro=\"title\"/>\n <text macro=\"edition\"/>\n </group>\n <text macro=\"editor\" prefix=\" \"/>\n <text macro=\"series\"/>\n <choose>\n <if type=\"report\">\n <group delimiter=\" \">\n <text variable=\"genre\"/>\n <text variable=\"number\"/>\n </group>\n </if>\n </choose>\n <group delimiter=\", \">\n <text macro=\"publisher\"/>\n <text macro=\"issued\"/>\n </group>\n <group delimiter=\", \">\n <text macro=\"volume\"/>\n <text macro=\"pages\"/>\n </group>\n </group>\n </else-if>\n <else-if type=\"patent\">\n <group delimiter=\", \">\n <group delimiter=\". \">\n <text macro=\"title\"/>\n <text variable=\"number\"/>\n </group>\n <date variable=\"issued\" form=\"text\"/>\n </group>\n </else-if>\n <else-if type=\"chapter paper-conference entry-dictionary entry-encyclopedia\" match=\"any\">\n <group delimiter=\"; \">\n <text macro=\"book-container\"/>\n <text macro=\"editor\"/>\n <text macro=\"series\"/>\n <group delimiter=\", \">\n <text macro=\"publisher\"/>\n <text macro=\"issued\"/>\n </group>\n <group delimiter=\", \">\n <text macro=\"volume\"/>\n <text macro=\"pages\"/>\n </group>\n </group>\n </else-if>\n <else-if type=\"webpage post post-weblog\" match=\"any\">\n <group delimiter=\". \">\n <text variable=\"title\" font-style=\"italic\"/>\n <text variable=\"container-title\"/>\n </group>\n </else-if>\n <else>\n <group delimiter=\", \">\n <group delimiter=\". \">\n <text macro=\"title\"/>\n <text variable=\"container-title\" font-style=\"italic\"/>\n </group>\n <group delimiter=\", \">\n <text macro=\"issued\"/>\n <text variable=\"volume\" font-style=\"italic\"/>\n <text variable=\"page\"/>\n </group>\n </group>\n </else>\n </choose>\n </group>\n <text macro=\"access\" prefix=\" \"/>\n </layout>\n </bibliography>\n</style>\n";
|
|
8
|
+
//# sourceMappingURL=americanChemicalSociety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"americanChemicalSociety.d.ts","sourceRoot":"","sources":["../../../../src/csl/core/styles/americanChemicalSociety.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,KAAK,o1WA+SjB,CAAC"}
|