feat: more attributes

This commit is contained in:
kolaente 2023-11-14 16:46:50 +01:00
parent 98158089c3
commit af85336a31
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 2662 additions and 1641 deletions

View File

@ -41,7 +41,13 @@ In the `bibliography.json` file, add sources like this:
} }
``` ```
Each source can have a url, a title or both. Each source can have the following attributes:
* `title` (mandatory)
* `url`
* `author`
* `accessed` (the date you've accessed the source)
* `date` (the date the source was published)
In your slides, reference a source like this: In your slides, reference a source like this:

View File

@ -9,17 +9,35 @@ const bib = computed(() => {
return [...bibliography.sources] return [...bibliography.sources]
.map(key => Bibliography[key]) .map(key => Bibliography[key])
}) })
const props = defineProps({
accessedTitle: {
default: 'accessed',
type: String,
},
})
</script> </script>
<template> <template>
<ul> <ul>
<li v-for="s in bib"> <li v-for="s in bib">
<template v-if="typeof s.author !== 'undefined' && s.author !== ''">
{{ s.author }},
</template>
{{ s.title }}
<template v-if="s.date !== '' && typeof s.date !== 'undefined'">
, ({{ s.date }})
</template>
<template v-if="s.url !== '' && typeof s.url !== 'undefined'"> <template v-if="s.url !== '' && typeof s.url !== 'undefined'">
<a :href="s.url"> <a :href="s.url">
{{ s.title === '' || typeof s.title === 'undefined' ? s.url : s.title }} {{ s.url }}
</a> </a>
</template> </template>
<template v-else>
{{ s.title }} <template v-if="s.accessed !== '' && typeof s.accessed !== 'undefined'">
({{ accessedTitle }} {{ s.accessed }})
</template> </template>
</li> </li>
</ul> </ul>

View File

@ -15,7 +15,7 @@
"author": "kolaente", "author": "kolaente",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@slidev/cli": "^0.37.1", "@slidev/cli": "^0.43.15",
"postcss": "^8.4.19" "postcss": "^8.4.19"
} }
} }

File diff suppressed because it is too large Load Diff