Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 184 additions & 0 deletions lxl-web/src/lib/assets/csl/elsevier-vancouver-author-date.csl
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<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">
<info>
<title>Elsevier - NLM/Vancouver (name-year)</title>
<title-short>Elsevier - Vancouver</title-short>
<id>http://www.zotero.org/styles/elsevier-vancouver-author-date</id>
<link href="http://www.zotero.org/styles/elsevier-vancouver-author-date" rel="self"/>
<link href="http://www.zotero.org/styles/elsevier-vancouver" rel="template"/>
<link href="https://www.elsevier.com/journals/clinical-neurophysiology/1388-2457/guide-for-authors#68000" rel="documentation"/>
<author>
<name>Sebastian Karcher</name>
</author>
<category citation-format="author-date"/>
<summary>A style for some Elsevier journals, resembles Vancouver style, but using author-date format</summary>
<updated>2019-10-15T22:06:38+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<macro name="author">
<names variable="author">
<name initialize-with="" delimiter=", " delimiter-precedes-last="always" name-as-sort-order="all" sort-separator=" "/>
<label form="long" prefix=", "/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
<text variable="title"/>
</substitute>
</names>
</macro>
<macro name="author-short">
<names variable="author">
<name form="short" and="text" delimiter=", " initialize-with=". "/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
<text variable="title" form="short"/>
</substitute>
</names>
</macro>
<macro name="editor">
<names variable="editor">
<name initialize-with="" delimiter=", " delimiter-precedes-last="always" name-as-sort-order="all" sort-separator=" "/>
<label form="long" prefix=", " suffix="."/>
</names>
</macro>
<macro name="year-date">
<choose>
<if variable="issued">
<date variable="issued">
<date-part name="year"/>
</date>
</if>
<else>
<text term="no date" form="short"/>
</else>
</choose>
</macro>
<macro name="publisher">
<text variable="publisher-place" suffix=": " text-case="title"/>
<text variable="publisher" suffix="; "/>
<text macro="year-date"/>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short"/>
</group>
</if>
<else>
<text variable="edition"/>
</else>
</choose>
</macro>
<macro name="access">
<choose>
<if variable="DOI">
<text variable="DOI" prefix="https://doi.org/"/>
</if>
<else-if type="webpage post-weblog" match="any">
<choose>
<if variable="URL">
<text variable="URL"/>
<group prefix=" (" suffix=")" delimiter=" ">
<text term="accessed"/>
<date variable="accessed" form="text"/>
</group>
</if>
</choose>
</else-if>
</choose>
</macro>
<citation et-al-min="3" et-al-use-first="1" disambiguate-add-givenname="true" disambiguate-add-year-suffix="true" collapse="year" cite-group-delimiter=", ">
<sort>
<key macro="author"/>
<key macro="year-date" sort="descending"/>
</sort>
<layout prefix="(" suffix=")" delimiter="; ">
<group delimiter=", ">
<text macro="author-short"/>
<text macro="year-date"/>
<group delimiter=" ">
<label variable="locator" form="short"/>
<text variable="locator"/>
</group>
</group>
</layout>
</citation>
<bibliography entry-spacing="0" et-al-min="7" et-al-use-first="6">
<sort>
<key macro="author"/>
<key macro="year-date" sort="descending"/>
</sort>
<layout suffix=".">
<text macro="author" suffix=". "/>
<choose>
<if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<group delimiter=". ">
<text variable="title"/>
<text variable="volume" prefix="vol. "/>
<text macro="edition"/>
<text macro="publisher"/>
</group>
</if>
<else-if type="chapter paper-conference" match="any">
<group delimiter=", ">
<group delimiter=". ">
<text variable="title"/>
<group>
<text term="in" text-case="sentence" suffix=": "/>
<text macro="editor"/>
</group>
<group delimiter=", ">
<text variable="container-title" form="short"/>
<text variable="volume" prefix="vol. "/>
</group>
<text macro="edition"/>
</group>
<text macro="publisher"/>
<group delimiter=" ">
<label variable="page" form="short" plural="never"/>
<text variable="page"/>
</group>
</group>
</else-if>
<else-if type="patent">
<group delimiter=", ">
<group delimiter=". ">
<text variable="title"/>
<text variable="number"/>
</group>
<text macro="year-date"/>
</group>
</else-if>
<else-if type="thesis">
<group delimiter=". ">
<text variable="title"/>
<text variable="genre"/>
<group delimiter=", ">
<text variable="publisher"/>
<text macro="year-date"/>
</group>
</group>
</else-if>
<else>
<group delimiter=":">
<group delimiter=" ">
<group delimiter=". ">
<text variable="title"/>
<text variable="container-title" form="short" text-case="title" strip-periods="true"/>
</group>
<group delimiter=";">
<text macro="year-date"/>
<text variable="volume"/>
</group>
</group>
<text variable="page" form="short"/>
</group>
</else>
</choose>
<text macro="access" prefix=". "/>
</layout>
</bibliography>
</style>
15 changes: 14 additions & 1 deletion lxl-web/src/lib/utils/citation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const availableFormats = {
name: 'Harvard',
fullName: 'Harvard (Södertörns högskola — author-date/Harvard)'
},
elsevier_vancouver: {
name: 'Vancouver',
fullName: 'Elsevier - NLM/Vancouver (name-year)'
},
ris: {
name: 'RIS',
fileFormat: 'ris'
Expand Down Expand Up @@ -73,6 +77,12 @@ export async function initCite(locale: LocaleCode) {
return cite.format('bibliography', { template: 'oxford_umu', format: 'html', lang });
case 'harvard_sh':
return cite.format('bibliography', { template: 'harvard_sh', format: 'html', lang });
case 'elsevier_vancouver':
return cite.format('bibliography', {
template: 'elsevier_vancouver',
format: 'html',
lang
});
default:
console.warn('asked for unavailable format', name);
return '-';
Expand All @@ -97,7 +107,10 @@ async function loadCiteResources() {
// https://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Fumea-university-oxford
oxford_umu: (await import('$lib/assets/csl/umea-university-oxford.csl?raw')).default,
// https://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Fsodertorns-hogskola-harvard
harvard_sh: (await import('$lib/assets/csl/sodertorns-hogskola-harvard.csl?raw')).default
harvard_sh: (await import('$lib/assets/csl/sodertorns-hogskola-harvard.csl?raw')).default,
// https://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Felsevier-vancouver-author-date
elsevier_vancouver: (await import('$lib/assets/csl/elsevier-vancouver-author-date.csl?raw'))
.default
};

// https://github.com/citation-js/citation-js/tree/main/packages/plugin-csl
Expand Down
Loading