Skip to content

Commit

Permalink
Closes #58 fixed appendix (#152)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
StefanThoma authored May 2, 2024
1 parent 6ff557f commit eb10dcf
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:
xportr
pharmaverseadam
link
sessioninfo
roxygen2
- name: Install tinytex
run: quarto install tool tinytex
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
4 changes: 4 additions & 0 deletions inst/WORDLIST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -716,3 +716,7 @@ img
src
svg
wikimedia
de
RightTool
Rlogo
sessioninfo
21 changes: 7 additions & 14 deletions posts/2023-10-30_floating_point/appendix.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand All @@ -47,7 +39,7 @@ insert_lockfile <- function(repo_spec, name,
branch,
collection,
name,
"renv.lock",
"session_info.txt",
sep = "/"
)
return(markdown_link(text, path))
Expand All @@ -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",
Expand All @@ -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 = ", "
)
Expand Down
4 changes: 3 additions & 1 deletion posts/2023-10-30_floating_point/floating_point.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
```
9 changes: 9 additions & 0 deletions session_info.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Session Info"
description: "This page displays the session information for the site."
---

```{r}
library(sessioninfo)
session_info()
```

0 comments on commit eb10dcf

Please sign in to comment.