Skip to content

Commit

Permalink
feat: add sicprod stylesheet for references
Browse files Browse the repository at this point in the history
  • Loading branch information
katharinawuensche committed Jul 30, 2024
1 parent f519e80 commit 2949b49
Show file tree
Hide file tree
Showing 3 changed files with 266 additions and 4,736 deletions.
253 changes: 253 additions & 0 deletions assets/sicprod-style.csl
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="note" version="1.0" page-range-format="expanded" demote-non-dropping-particle="never" default-locale="de-DE">
<!-- This style was edited with the Visual CSL Editor (https://editor.citationstyles.org/visualEditor/) -->
<info>
<title>SiCProD Style</title>
<title-short>SiCProD</title-short>
<id>http://www.zotero.org/styles/sicprod-style</id>
<link href="http://www.zotero.org/styles/sicprod-style" rel="self"/>
<link href="http://www.zotero.org/styles/societe-archeologique-de-bordeaux" rel="template"/>
<category citation-format="note"/>
<updated>2024-07-30T07:43:59+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" delimiter=", ">
<name delimiter=" / " delimiter-precedes-last="never" name-as-sort-order="all"/>
<substitute>
<text macro="editor"/>
</substitute>
</names>
</macro>
<macro name="editor">
<names variable="editor">
<name delimiter=" / " delimiter-precedes-last="never" name-as-sort-order="all" name-as-sort-order="all" sort-separator=", "/>
<label form="short" text-case="capitalize-first" prefix=" (" suffix=")"/>
</names>
</macro>
<macro name="author-short">
<names variable="author" delimiter=", ">
<name form="short" delimiter=" / "/>
<substitute>
<text macro="editor-short"/>
<text variable="title" form="short"/>
</substitute>
</names>
</macro>
<macro name="editor-short">
<names variable="editor">
<name form="short" delimiter=", " and="text"/>
<label form="short" text-case="capitalize-first" prefix=" (" suffix=")"/>
</names>
</macro>
<macro name="editor-short-bib">
<text term="in" suffix=":"/>
<names variable="editor">
<name delimiter=" /" prefix=" " name-as-sort-order="all"/>
<label form="short" text-case="capitalize-first" prefix=" (" suffix=")"/>
</names>
</macro>
<macro name="access">
<date form="numeric" variable="accessed"/>
</macro>
<macro name="collection">
<group delimiter=", " prefix="(" suffix=")">
<text variable="collection-title"/>
<text variable="collection-number"/>
</group>
</macro>
<macro name="title">
<text variable="title"/>
</macro>
<macro name="year-date">
<choose>
<if variable="issued">
<date variable="issued" prefix=" ">
<date-part name="year"/>
</date>
</if>
<else>
<text term="no date" form="short"/>
</else>
</choose>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short" suffix="., " text-case="lowercase" strip-periods="true"/>
</group>
</if>
<else>
<text variable="edition"/>
</else>
</choose>
</macro>
<macro name="pages">
<group delimiter=" ">
<label text-case="capitalize-first" vertical-align="baseline" form="short"/>
<text variable="page"/>
</group>
</macro>
<citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true">
<sort>
<key variable="issued"/>
</sort>
<layout delimiter=" ; ">
<text macro="author-short" suffix=" "/>
<text macro="year-date"/>
<choose>
<if locator="page">
<text variable="locator" prefix=", "/>
</if>
<else-if locator="paragraph">
<text variable="locator" prefix=", §"/>
</else-if>
<else>
<group prefix=", ">
<label variable="locator" form="short" suffix=". "/>
<text variable="locator"/>
</group>
</else>
</choose>
</layout>
</citation>
<bibliography et-al-min="4" et-al-use-first="1" subsequent-author-substitute="" hanging-indent="true">
<sort>
<key macro="author"/>
<key variable="issued"/>
<key variable="title"/>
<key variable="page-first"/>
</sort>
<layout suffix=".">
<choose>
<if type="manuscript" match="any">
<group delimiter=", ">
<text variable="archive"/>
<text variable="archive_location"/>
<text macro="title"/>

<choose>
<if variable="note" match="any">
<text variable="note"/>
</if>
<else>
<text macro="pages"/>
</else>
</choose>

</group>
</if>
<else-if type="book" match="any">
<group delimiter=", ">
<group delimiter=" ">
<group delimiter=": ">
<text macro="author"/>
<text macro="title"/>
</group>
<group>
<text macro="edition"/>
<text macro="collection"/>
</group>
</group>
<group delimiter=" ">
<text variable="publisher-place"/>
<text macro="year-date"/>
</group>
<text macro="pages"/>
</group>
</else-if>
<else-if type="entry-encyclopedia">
<group delimiter=", ">
<group delimiter=": ">
<text macro="author"/>
<text macro="title" prefix="Art. " quotes="true"/>
</group>
<group delimiter=", ">
<group>
<choose>
<if variable="title-short" match="any">
<text variable="title-short"/>
</if>
<else>
<group delimiter=": ">
<text term="in"/>
<text variable="container-title"/>
</group>
</else>
</choose>
<text variable="volume"/>
<text macro="year-date" prefix=" (" suffix=")"/>
</group>
<text macro="pages"/>
<text variable="URL" />
</group>

</else-if>
<else-if type="manuscript book entry-encyclopedia" match="none">
<group delimiter=", ">
<group delimiter=": ">
<text macro="author"/>
<text macro="title"/>
</group>
<choose>
<if type="thesis">
<group delimiter=", " suffix=".">
<text variable="genre"/>
<text variable="publisher"/>
<text variable="publisher-place"/>
<text macro="year-date"/>
</group>
</if>
<else-if type="webpage post post-weblog" match="any">
<group delimiter=" ">
<text term="online"/>
<text term="available at" suffix=":"/>
<text variable="URL"/>
<text prefix="[" macro="access" suffix="]"/>
</group>
</else-if>
<else-if type="article-journal article-magazine article-newspaper paper-conference" match="any">
<group delimiter=", ">
<group delimiter=" ">
<group delimiter=": ">
<text term="in"/>
<text variable="container-title"/>
</group>
<text variable="volume"/>
<text macro="year-date" prefix="(" suffix=")"/>
</group>
<text macro="pages"/>
</group>
</else-if>

<else-if type="chapter entry-dictionary" match="any">
<group delimiter=", ">
<text macro="editor-short-bib"/>
<group delimiter=": ">
<text variable="container-title"/>
</group>
<group>
<text variable="publisher-place"/>
<text macro="year-date"/>
</group>
<text macro="pages"/>
</group>
</else-if>
<else-if type="report" match="any">
<group>
<text variable="genre" prefix=", " font-style="italic"/>
<text variable="publisher-place" prefix=", " suffix=", "/>
<text variable="publisher"/>
<text macro="year-date" prefix=", "/>
<text variable="page" prefix=", " suffix=" p."/>
</group>
</else-if>
</choose>
</group>
</else-if>
</choose>
</layout>
</bibliography>
</style>
15 changes: 13 additions & 2 deletions components/reference-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Cite from "citation-js";
import { ArrowDownToLine, BookOpenText } from "lucide-vue-next";

import type { Reference } from "@/types/resulttypes";
import styleSheet from "~/assets/sicprod-style.csl?raw";

const t = useTranslations();
const props = withDefaults(
Expand All @@ -26,12 +27,22 @@ const { floatingStyles } = useFloating(reference, floating, {
middleware: [offset(props.popupOffset), shift({ padding: 8 })],
});

let config = Cite.plugins.config.get("@csl");
config.templates.add("sicprod-stylesheet", styleSheet);
const citationConfig = {
format: "html",
template: "apa",
template: "sicprod-stylesheet",
lang: "en-EN",
};
const citation = computed(() => {
let c = props.references.map((r) => new Cite(r.bibtex));
let c = props.references.map(
(r) =>
new Cite({
...r.bibtex,
note: r.folio,
page: [...new Set([r.pages_start, r.pages_end])].join("-"),
}),
);
return c;
});
function downloadBibTex() {
Expand Down
Loading

0 comments on commit 2949b49

Please sign in to comment.