#' Make markdown documents for papers
#'
#' This function will create markdown documents in the Hugo Academic style for papers
#' specified in a Google Sheet.
#'
#' @param dir The directory you would like the markdown documents to be saved in
#' @param id Your Google Sheet id
#' @export
#'
make_paper_md <- function(dir, id = "1HPQDH3tOXtZb1DV--8wR9CKAzUz5aywWc2vM3OQ5SrU") {
d <- googlesheets4::range_read(googlesheets4::as_sheets_id(id))
d <- d[d$type == "article", ]
md <- glue::glue_data(d, {
"+++
## Generated by the R package lazyacademic
## Do not edit directly, edit the Google Sheet (id = {id})
title = \"{title}\"
date = {date}
authors = [\"{authors}\"]
publication_types = [\"{pub_type}\"]
publication = \"In *{publication}*\"
abstract = \"{abstract}\"
selected = {tolower(selected)}
url_pdf = \"{url_pdf}\"
url_preprint = \"{url_preprint}\"
url_code = \"{url_code}\"
url_dataset = \"{url_dataset}\"
url_project = \"{url_project}\"
url_slides = \"{url_slides}\"
url_video = \"{url_video}\"
url_poster = \"{url_poster}\"
url_source = \"{url_source}\"
math = true
highlight = true
[header]
image = \"\"
caption = \"\"
+++
"
}, .na = "")
file_base <- purrr::map_chr(d$bib, ~ strsplit(.x, '[{,]')[[1]][2])
file_name <- glue::glue("{dir}/{file_base}.md")
purrr::walk2(md, file_name, writeLines)
}
# url_preprint = ""
# url_code = ""
# url_dataset = ""
# url_project = ""
# url_slides = ""
# url_video = ""
# url_poster = ""
# url_source = ""
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.