Skip to content

Commit 7c8c78f

Browse files
feat(lxlweb): add Vancouver citation style (#1702)
* Add and implement elsevier-vancouver-author-date citation style
1 parent 60e7f17 commit 7c8c78f

2 files changed

Lines changed: 198 additions & 1 deletion

File tree

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<style xmlns="http://purl.org/net/xbiblio/csl" page-range-format="minimal" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">
3+
<info>
4+
<title>Elsevier - NLM/Vancouver (name-year)</title>
5+
<title-short>Elsevier - Vancouver</title-short>
6+
<id>http://www.zotero.org/styles/elsevier-vancouver-author-date</id>
7+
<link href="http://www.zotero.org/styles/elsevier-vancouver-author-date" rel="self"/>
8+
<link href="http://www.zotero.org/styles/elsevier-vancouver" rel="template"/>
9+
<link href="https://www.elsevier.com/journals/clinical-neurophysiology/1388-2457/guide-for-authors#68000" rel="documentation"/>
10+
<author>
11+
<name>Sebastian Karcher</name>
12+
</author>
13+
<category citation-format="author-date"/>
14+
<summary>A style for some Elsevier journals, resembles Vancouver style, but using author-date format</summary>
15+
<updated>2019-10-15T22:06:38+00:00</updated>
16+
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
17+
</info>
18+
<macro name="author">
19+
<names variable="author">
20+
<name initialize-with="" delimiter=", " delimiter-precedes-last="always" name-as-sort-order="all" sort-separator=" "/>
21+
<label form="long" prefix=", "/>
22+
<substitute>
23+
<names variable="editor"/>
24+
<names variable="translator"/>
25+
<text variable="title"/>
26+
</substitute>
27+
</names>
28+
</macro>
29+
<macro name="author-short">
30+
<names variable="author">
31+
<name form="short" and="text" delimiter=", " initialize-with=". "/>
32+
<substitute>
33+
<names variable="editor"/>
34+
<names variable="translator"/>
35+
<text variable="title" form="short"/>
36+
</substitute>
37+
</names>
38+
</macro>
39+
<macro name="editor">
40+
<names variable="editor">
41+
<name initialize-with="" delimiter=", " delimiter-precedes-last="always" name-as-sort-order="all" sort-separator=" "/>
42+
<label form="long" prefix=", " suffix="."/>
43+
</names>
44+
</macro>
45+
<macro name="year-date">
46+
<choose>
47+
<if variable="issued">
48+
<date variable="issued">
49+
<date-part name="year"/>
50+
</date>
51+
</if>
52+
<else>
53+
<text term="no date" form="short"/>
54+
</else>
55+
</choose>
56+
</macro>
57+
<macro name="publisher">
58+
<text variable="publisher-place" suffix=": " text-case="title"/>
59+
<text variable="publisher" suffix="; "/>
60+
<text macro="year-date"/>
61+
</macro>
62+
<macro name="edition">
63+
<choose>
64+
<if is-numeric="edition">
65+
<group delimiter=" ">
66+
<number variable="edition" form="ordinal"/>
67+
<text term="edition" form="short"/>
68+
</group>
69+
</if>
70+
<else>
71+
<text variable="edition"/>
72+
</else>
73+
</choose>
74+
</macro>
75+
<macro name="access">
76+
<choose>
77+
<if variable="DOI">
78+
<text variable="DOI" prefix="https://doi.org/"/>
79+
</if>
80+
<else-if type="webpage post-weblog" match="any">
81+
<choose>
82+
<if variable="URL">
83+
<text variable="URL"/>
84+
<group prefix=" (" suffix=")" delimiter=" ">
85+
<text term="accessed"/>
86+
<date variable="accessed" form="text"/>
87+
</group>
88+
</if>
89+
</choose>
90+
</else-if>
91+
</choose>
92+
</macro>
93+
<citation et-al-min="3" et-al-use-first="1" disambiguate-add-givenname="true" disambiguate-add-year-suffix="true" collapse="year" cite-group-delimiter=", ">
94+
<sort>
95+
<key macro="author"/>
96+
<key macro="year-date" sort="descending"/>
97+
</sort>
98+
<layout prefix="(" suffix=")" delimiter="; ">
99+
<group delimiter=", ">
100+
<text macro="author-short"/>
101+
<text macro="year-date"/>
102+
<group delimiter=" ">
103+
<label variable="locator" form="short"/>
104+
<text variable="locator"/>
105+
</group>
106+
</group>
107+
</layout>
108+
</citation>
109+
<bibliography entry-spacing="0" et-al-min="7" et-al-use-first="6">
110+
<sort>
111+
<key macro="author"/>
112+
<key macro="year-date" sort="descending"/>
113+
</sort>
114+
<layout suffix=".">
115+
<text macro="author" suffix=". "/>
116+
<choose>
117+
<if type="bill book graphic legal_case legislation motion_picture report song" match="any">
118+
<group delimiter=". ">
119+
<text variable="title"/>
120+
<text variable="volume" prefix="vol. "/>
121+
<text macro="edition"/>
122+
<text macro="publisher"/>
123+
</group>
124+
</if>
125+
<else-if type="chapter paper-conference" match="any">
126+
<group delimiter=", ">
127+
<group delimiter=". ">
128+
<text variable="title"/>
129+
<group>
130+
<text term="in" text-case="sentence" suffix=": "/>
131+
<text macro="editor"/>
132+
</group>
133+
<group delimiter=", ">
134+
<text variable="container-title" form="short"/>
135+
<text variable="volume" prefix="vol. "/>
136+
</group>
137+
<text macro="edition"/>
138+
</group>
139+
<text macro="publisher"/>
140+
<group delimiter=" ">
141+
<label variable="page" form="short" plural="never"/>
142+
<text variable="page"/>
143+
</group>
144+
</group>
145+
</else-if>
146+
<else-if type="patent">
147+
<group delimiter=", ">
148+
<group delimiter=". ">
149+
<text variable="title"/>
150+
<text variable="number"/>
151+
</group>
152+
<text macro="year-date"/>
153+
</group>
154+
</else-if>
155+
<else-if type="thesis">
156+
<group delimiter=". ">
157+
<text variable="title"/>
158+
<text variable="genre"/>
159+
<group delimiter=", ">
160+
<text variable="publisher"/>
161+
<text macro="year-date"/>
162+
</group>
163+
</group>
164+
</else-if>
165+
<else>
166+
<group delimiter=":">
167+
<group delimiter=" ">
168+
<group delimiter=". ">
169+
<text variable="title"/>
170+
<text variable="container-title" form="short" text-case="title" strip-periods="true"/>
171+
</group>
172+
<group delimiter=";">
173+
<text macro="year-date"/>
174+
<text variable="volume"/>
175+
</group>
176+
</group>
177+
<text variable="page" form="short"/>
178+
</group>
179+
</else>
180+
</choose>
181+
<text macro="access" prefix=". "/>
182+
</layout>
183+
</bibliography>
184+
</style>

‎lxl-web/src/lib/utils/citation.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export const availableFormats = {
2525
name: 'Harvard',
2626
fullName: 'Harvard (Södertörns högskola — author-date/Harvard)'
2727
},
28+
elsevier_vancouver: {
29+
name: 'Vancouver',
30+
fullName: 'Elsevier - NLM/Vancouver (name-year)'
31+
},
2832
ris: {
2933
name: 'RIS',
3034
fileFormat: 'ris'
@@ -73,6 +77,12 @@ export async function initCite(locale: LocaleCode) {
7377
return cite.format('bibliography', { template: 'oxford_umu', format: 'html', lang });
7478
case 'harvard_sh':
7579
return cite.format('bibliography', { template: 'harvard_sh', format: 'html', lang });
80+
case 'elsevier_vancouver':
81+
return cite.format('bibliography', {
82+
template: 'elsevier_vancouver',
83+
format: 'html',
84+
lang
85+
});
7686
default:
7787
console.warn('asked for unavailable format', name);
7888
return '-';
@@ -97,7 +107,10 @@ async function loadCiteResources() {
97107
// https://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Fumea-university-oxford
98108
oxford_umu: (await import('$lib/assets/csl/umea-university-oxford.csl?raw')).default,
99109
// https://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Fsodertorns-hogskola-harvard
100-
harvard_sh: (await import('$lib/assets/csl/sodertorns-hogskola-harvard.csl?raw')).default
110+
harvard_sh: (await import('$lib/assets/csl/sodertorns-hogskola-harvard.csl?raw')).default,
111+
// https://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Felsevier-vancouver-author-date
112+
elsevier_vancouver: (await import('$lib/assets/csl/elsevier-vancouver-author-date.csl?raw'))
113+
.default
101114
};
102115

103116
// https://github.com/citation-js/citation-js/tree/main/packages/plugin-csl

0 commit comments

Comments
 (0)