Skip to content

Commit

Permalink
Merge pull request #76 from ianalexmac/main
Browse files Browse the repository at this point in the history
Add citation buttons back to introduction page
  • Loading branch information
jikaczmarski authored Jul 31, 2024
2 parents 59f2e44 + 0d3c72a commit b87174d
Showing 1 changed file with 61 additions and 6 deletions.
67 changes: 61 additions & 6 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,82 @@ Please explore the data using the chapter navigation links in the left sidebar a

## How to Cite
::: {.content-visible when-format="html"}
##### Mystery format:

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');
```

:::


::: {.content-visible when-format="pdf"}
##### Mystery format:
Alaska Center for Energy and Power. "2024 Alaska Energy Trends Report." Accessed `r Sys.Date()`. [PDF version]. Available at: https://acep-uaf.github.io/aetr-web-book-2024/report2024.pdf
:::

###### BibLaTeX format:
##### APA:
Alaska Center for Energy and Power. (2024). Alaska Energy Trends Report. Retrieved `r format(Sys.Date(), "%B %d, %Y")`, from https://acep-uaf.github.io/aetr-web-book-2024/report2024.pdf

###### BibLaTeX:
```{r, eval=FALSE, echo=TRUE}
@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 = {2024-07-23}
urldate = {2024-08-01}
}
```

:::

## Executive Summary {.unnumbered}

Expand Down

0 comments on commit b87174d

Please sign in to comment.