-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mau Zsofia Abraham
committed
Jan 25, 2025
1 parent
2b3d28d
commit d25d14f
Showing
6 changed files
with
292 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script setup lang="ts"> | ||
import "@citation-js/plugin-csl"; | ||
import { Cite, type CSLItemType, type CSLName } from "@citation-js/core"; | ||
interface Props { | ||
author: Array<CSLName>; | ||
type?: string; | ||
title?: string; | ||
editor?: Array<CSLName>; | ||
containerTitle?: string; | ||
issued?: Array<number>; | ||
url?: string; | ||
} | ||
const props = defineProps<Props>(); | ||
const date = new Date(); | ||
const entry = new Cite({ | ||
type: props.type as CSLItemType, | ||
editor: props.editor as Array<CSLName>, | ||
"container-title": props.containerTitle, | ||
title: props.title, | ||
author: props.author as Array<CSLName>, | ||
issued: { "date-parts": [props.issued] }, | ||
}); | ||
const citation = entry.format("bibliography", { | ||
format: "html", | ||
template: "apa", | ||
// prepend (entry) { | ||
// return `[${entry.id}]: ` | ||
// }, | ||
append: ` [Available online at ${props.url}. | ||
Accessed on ${String(date.getDate()).padStart(2, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getFullYear())}.]`, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div v-html="citation" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.