Skip to content

Commit

Permalink
91 floating point (#92)
Browse files Browse the repository at this point in the history
* Automatically copy appendix to new file

* added post skeleton

* styler

* styler

* update script

* spelling

* update script

* update script

* add more text

* update script

* update script

* update script

* finished draft

* CICD FIX

* Update posts/2023-10-30_floating_point/floating_point.qmd

Co-authored-by: Ben Straub <[email protected]>

* Update posts/2023-10-30_floating_point/floating_point.qmd

Co-authored-by: Ben Straub <[email protected]>

* Update posts/2023-10-30_floating_point/floating_point.qmd

Co-authored-by: Ben Straub <[email protected]>

* Update posts/2023-10-30_floating_point/floating_point.qmd

Co-authored-by: Ben Straub <[email protected]>

* Update posts/2023-10-30_floating_point/floating_point.qmd

Co-authored-by: Ben Straub <[email protected]>

* implemented feedback

* implemented feedback

---------

Co-authored-by: Ben Straub <[email protected]>
  • Loading branch information
StefanThoma and bms63 authored Nov 1, 2023
1 parent 36952e9 commit 8b44cc8
Show file tree
Hide file tree
Showing 7 changed files with 547 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/help_create_blogpost.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ create_post <- function(post_name,

# Write new .qmd file
writeLines(result, con = paste(file.path(new_dir, snake_name), ".qmd", sep = ""))
file.create(paste(file.path(new_dir, "appendix"), ".R", sep = ""))
file.copy("inst/template/appendix.R", paste(file.path(new_dir, "appendix"), ".R", sep = ""))
image_name <- paste(cover_image, ".png", sep = "")
file.copy(from = file.path(path_to_img, image_name), to = file.path(new_dir, image_name))

Expand Down
32 changes: 32 additions & 0 deletions inst/WORDLIST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ reproducibility
behaviour
Farrugia
ethz
ANRHI
adadas
adlbc
adsl
Expand Down Expand Up @@ -444,3 +445,34 @@ Viyash
webm
Xiao
Zhao
aa
af
atoxgr
bdfef
ChatGPT
comparators
CTCAE
ctcv
dir
fpCompare
getOption
Mächler
mmaechler
NCI
packageVersion
ProgRRR
rda
signif
anrind
daids
DAIDS
defaultPageSize
Lipase
niaid
nih
PredictiveEcology
reactable
representable
Representable
resizable
rsc
78 changes: 78 additions & 0 deletions inst/template/appendix.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# markdown helpers --------------------------------------------------------

markdown_appendix <- function(name, content) {
paste(paste("##", name, "{.appendix}"), " ", content, sep = "\n")
}
markdown_link <- function(text, path) {
paste0("[", text, "](", path, ")")
}



# worker functions --------------------------------------------------------

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 = "/"
)
return(markdown_link(text, path))
}

insert_timestamp <- function(tzone = Sys.timezone()) {
time <- lubridate::now(tzone = tzone)
stamp <- as.character(time, tz = tzone, usetz = TRUE)
return(stamp)
}

insert_lockfile <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "R environment") {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"renv.lock",
sep = "/"
)
return(markdown_link(text, path))
}



# top level function ------------------------------------------------------

insert_appendix <- function(repo_spec, name, collection = "posts") {
appendices <- paste(
markdown_appendix(
name = "Last updated",
content = insert_timestamp()
),
" ",
markdown_appendix(
name = "Details",
content = paste(
insert_source(repo_spec, name, collection),
insert_lockfile(repo_spec, name, collection),
sep = ", "
)
),
sep = "\n"
)
knitr::asis_output(appendices)
}
Empty file.
Binary file added posts/2023-10-30_floating_point/admiral.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions posts/2023-10-30_floating_point/appendix.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# markdown helpers --------------------------------------------------------

markdown_appendix <- function(name, content) {
paste(paste("##", name, "{.appendix}"), " ", content, sep = "\n")
}
markdown_link <- function(text, path) {
paste0("[", text, "](", path, ")")
}



# worker functions --------------------------------------------------------

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 = "/"
)
return(markdown_link(text, path))
}

insert_timestamp <- function(tzone = Sys.timezone()) {
time <- lubridate::now(tzone = tzone)
stamp <- as.character(time, tz = tzone, usetz = TRUE)
return(stamp)
}

insert_lockfile <- function(repo_spec, name,
collection = "posts",
branch = "main",
host = "https://github.com",
text = "R environment") {
path <- paste(
host,
repo_spec,
"tree",
branch,
collection,
name,
"renv.lock",
sep = "/"
)
return(markdown_link(text, path))
}



# top level function ------------------------------------------------------

insert_appendix <- function(repo_spec, name, collection = "posts") {
appendices <- paste(
markdown_appendix(
name = "Last updated",
content = insert_timestamp()
),
" ",
markdown_appendix(
name = "Details",
content = paste(
insert_source(repo_spec, name, collection),
insert_lockfile(repo_spec, name, collection),
sep = ", "
)
),
sep = "\n"
)
knitr::asis_output(appendices)
}
Loading

0 comments on commit 8b44cc8

Please sign in to comment.