From eb10dcf837ee83d5d1b262c514ca531ba64167b7 Mon Sep 17 00:00:00 2001 From: StefanThoma <40463122+StefanThoma@users.noreply.github.com> Date: Thu, 2 May 2024 15:37:59 +0200 Subject: [PATCH] Closes #58 fixed appendix (#152) * added session info and fixed link to source * fix category extraction, not sure what for * added session info site * CICD checks fixed * remove session info at post level * update to include roxygen * added spell_check * added spell_check * fix * update workflow * new spell check workflow * UPDATE WORKFLOW * fix styling * delete other spell check --- .github/workflows/publish.yml | 4 +++- .github/workflows/spellcheck.yml | 4 ++++ _quarto.yml | 2 ++ index.qmd | 4 ++-- inst/WORDLIST.txt | 4 ++++ posts/2023-10-30_floating_point/appendix.R | 21 +++++++------------ .../floating_point.qmd | 4 +++- session_info.qmd | 9 ++++++++ 8 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 session_info.qmd diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2e393cbf..0a1ee4bf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,7 +41,9 @@ jobs: xportr pharmaverseadam link - + sessioninfo + roxygen2 + - name: Install tinytex run: quarto install tool tinytex diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index 43cb4c01..2c382002 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -13,6 +13,10 @@ jobs: run: if (!require("spelling")) install.packages("spelling") shell: Rscript {0} + - name: Install roxygen2 + run: if (!require("roxygen2")) install.packages("roxygen2") + shell: Rscript {0} + - name: Run Spelling Check test run: spelling::spell_check_files(list.files(pattern = ".*.qmd$", recursive = TRUE), ignore = readr::read_lines("inst/WORDLIST.txt")) shell: Rscript {0} diff --git a/_quarto.yml b/_quarto.yml index 7a4f1b2f..98beb36b 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -17,6 +17,8 @@ website: - icon: github aria-label: github href: https://github.com/pharmaverse/blog + - text: "Session Info" + href: session_info.html format: html: theme: diff --git a/index.qmd b/index.qmd index f9b104e0..c88c619a 100644 --- a/index.qmd +++ b/index.qmd @@ -27,14 +27,14 @@ posts <- list.dirs( ) # extract the slugs -slugs <- gsub("^.*_", "", posts) +slugs <- sub(".*?_", "", posts) # lines to insert to a netlify _redirect file post_redirects <- paste0("/", slugs, " ", "/posts/", posts) # function to extract post categories from index.qmd files get_post_categories <- function(post) { - file <- here::here("posts", post) |> fs::path("index.qmd") + file <- here::here("posts", post) |> list.files(pattern = ".qmd", full.names = TRUE) if (!fs::file_exists(file)) { return(character(0)) } diff --git a/inst/WORDLIST.txt b/inst/WORDLIST.txt index ca25d01e..a81d5ab5 100644 --- a/inst/WORDLIST.txt +++ b/inst/WORDLIST.txt @@ -716,3 +716,7 @@ img src svg wikimedia +de +RightTool +Rlogo +sessioninfo diff --git a/posts/2023-10-30_floating_point/appendix.R b/posts/2023-10-30_floating_point/appendix.R index ece5203f..fe465c37 100644 --- a/posts/2023-10-30_floating_point/appendix.R +++ b/posts/2023-10-30_floating_point/appendix.R @@ -15,17 +15,9 @@ insert_source <- function(repo_spec, name, collection = "posts", branch = "main", host = "https://github.com", - text = "source code") { - path <- paste( - host, - repo_spec, - "tree", - branch, - collection, - name, - "code_sections.qmd", - sep = "/" - ) + text = "Session info", + file_name) { + path <- "https://pharmaverse.github.io/blog/_site/session_info.html" return(markdown_link(text, path)) } @@ -47,7 +39,7 @@ insert_lockfile <- function(repo_spec, name, branch, collection, name, - "renv.lock", + "session_info.txt", sep = "/" ) return(markdown_link(text, path)) @@ -57,7 +49,7 @@ insert_lockfile <- function(repo_spec, name, # top level function ------------------------------------------------------ -insert_appendix <- function(repo_spec, name, collection = "posts") { +insert_appendix <- function(repo_spec, name, collection = "posts", file_name) { appendices <- paste( markdown_appendix( name = "Last updated", @@ -67,7 +59,8 @@ insert_appendix <- function(repo_spec, name, collection = "posts") { markdown_appendix( name = "Details", content = paste( - insert_source(repo_spec, name, collection), + insert_source(repo_spec, name, collection, file_name = file_name), + # get renv information, insert_lockfile(repo_spec, name, collection), sep = ", " ) diff --git a/posts/2023-10-30_floating_point/floating_point.qmd b/posts/2023-10-30_floating_point/floating_point.qmd index 52e43e73..e511e50d 100644 --- a/posts/2023-10-30_floating_point/floating_point.qmd +++ b/posts/2023-10-30_floating_point/floating_point.qmd @@ -353,6 +353,8 @@ I.e. `.Machine$double.eps / 1.8` is still detectable, while `.Machine$double.eps source("appendix.R") insert_appendix( repo_spec = "pharmaverse/blog", - name = long_slug + name = long_slug, + # file_name should be the name of your file + file_name = list.files() %>% stringr::str_subset(".qmd") %>% first() ) ``` diff --git a/session_info.qmd b/session_info.qmd new file mode 100644 index 00000000..301a711e --- /dev/null +++ b/session_info.qmd @@ -0,0 +1,9 @@ +--- +title: "Session Info" +description: "This page displays the session information for the site." +--- + +```{r} +library(sessioninfo) +session_info() +```