-
Notifications
You must be signed in to change notification settings - Fork 4
/
_citations.qmd
55 lines (45 loc) · 1.54 KB
/
_citations.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Alaska Center for Energy and Power. "2024 Alaska Energy Trends Report Web Book." Accessed `{ojs} currentDate`. https://acep-uaf.github.io/aetr-web-book-2024
```{ojs}
//| echo: false
// set up today's date
date = new Date();
day = date.getDate();
month = date.toLocaleString('default', { month: 'long' });
year = date.getFullYear();
month_2digit = (date.getMonth() + 1).toString().padStart(2, "0");
day_2digit = date.getDate().toString().padStart(2, "0");
currentDate = `${month} ${day}, ${year}`
// build a button
citation_button = (blob, filename = 'test.bib', displayname) => {
const button = DOM.download(
blob,
filename,
`${displayname}`
);
return button;
}
// BibLaTeX content
biblatexContent =
`@online{aetr_web_book_2024,
author = {{Alaska Center for Energy and Power}},
title = {{2024 Alaska Electricity Trends Report}},
year = 2024,
url = {https://acep-uaf.github.io/aetr-web-book-2024/},
urldate = {${year}-${month_2digit}-${day_2digit}}
}`
risContent =
`TY - ELEC
AU - Alaska Center for Energy and Power
TI - 2024 Alaska Electricity Trends Report
PY - 2024
DA - {${year}-${month_2digit}-${day_2digit}}
UR - https://acep-uaf.github.io/aetr-web-book-2024/
N1 - Accessed on ${currentDate}
ER -`
// Create the blobs
biblatex_blob = new Blob([biblatexContent], { type: 'text/plain' });
ris_blob = new Blob([risContent], { type: 'text/plain' });
// Insert blobs into buttons
citation_button(biblatex_blob, 'aetr_web_book_2024.bib', 'BibLaTeX');
citation_button(ris_blob, 'aetr_web_book_2024.ris', 'RIS');
```