diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml
index c67df158..3164365d 100644
--- a/.github/workflows/common.yml
+++ b/.github/workflows/common.yml
@@ -35,7 +35,7 @@ concurrency:
env:
R_VERSION: "4.1"
-
+
jobs:
get_r_version:
name: Get R version
@@ -91,7 +91,7 @@ jobs:
# Whether to skip multiversion docs
# Note that if you have multiple versions of docs,
# your URL links are likely to break due to path changes
- skip-multiversion-docs: false
+ skip-multiversion-docs: true
linter:
name: Lint
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main
diff --git a/README.Rmd b/README.Rmd
index 1aa91d5c..df28bffa 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -4,39 +4,7 @@ output: md_document
date: '2022-08-06'
---
-```{r setup, include=FALSE}
-knitr::opts_chunk$set(echo = TRUE)
-link <- function(text, url) {
- return(
- paste0(
- "[", text, "]",
- "(", url, ")"
- )
- )
-}
-dyn_link <- function(text,
- base_url,
- relative_url = "",
- # Change to TRUE when admiral adopts multiversion docs
- is_multiversion = TRUE,
- multiversion_default_ref = "main") {
- url <- paste(base_url, relative_url, "", sep = "/")
- if (is_multiversion) {
- url <- paste(
- base_url,
- Sys.getenv("BRANCH_NAME", multiversion_default_ref),
- "",
- sep = "/"
- )
- }
- return(link(text, url))
-}
-# Other variables
-admiral_homepage <- "https://pharmaverse.github.io/admiral"
-```
-
-
# Admiral Extension for Ophthalmology
@@ -68,7 +36,7 @@ remotes::install_github("pharmaverse/admiralophtha", ref = "devel")
## References and Documentation
-* Please refer to the `r dyn_link("{admiral} References and Documentation", admiral_homepage, "index.html#references-and-documentation")`.
+* Please refer to the [the `{admiral}` References & Documentation page](https://pharmaverse.github.io/admiral/index.html#references-and-documentation).
## R Versions
diff --git a/README.md b/README.md
index 02c1593d..fb4f8d3a 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,4 @@
-
-
-
# Admiral Extension for Ophthalmology
diff --git a/_pkgdown.yml b/_pkgdown.yml
index ad92ba98..ebb910ba 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -12,6 +12,10 @@ repo:
source: https://github.com/pharmaverse/admiralophtha/blob/main/
issue: https://github.com/pharmaverse/admiralophtha/issues/
user: https://github.com/
+
+development:
+ mode: auto
+
news:
cran_dates: false
reference:
@@ -90,8 +94,8 @@ reference:
navbar:
structure:
- left: [getstarted, reference, articles, news]
- right: [search, slack, newissue, github]
+ left: [getstarted, reference, articles, news, versions]
+ right: [search, slack, history, newissue, github]
components:
getstarted:
text: Get Started
@@ -110,6 +114,10 @@ navbar:
href: articles/adbcva.html
- text: Creating ADVFQ
href: articles/advfq.html
+ history:
+ icon: fa-history
+ href: articles/website-versions.html
+ aria-label: Previous Release Websites
slack:
icon: fa-slack
href: https://app.slack.com/client/T028PB489D3/C02M8KN8269
diff --git a/vignettes/adbcva.Rmd b/vignettes/adbcva.Rmd
index c43561cb..fb3a2da1 100644
--- a/vignettes/adbcva.Rmd
+++ b/vignettes/adbcva.Rmd
@@ -13,33 +13,6 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
-link <- function(text, url) {
- return(
- paste0(
- "[", text, "]",
- "(", url, ")"
- )
- )
-}
-dyn_link <- function(text,
- base_url,
- relative_url = "",
- # Change to TRUE when admiral adopts multiversion docs
- is_multiversion = FALSE,
- multiversion_default_ref = "main") {
- url <- paste(base_url, relative_url, sep = "/")
- if (is_multiversion) {
- url <- paste(
- base_url,
- Sys.getenv("BRANCH_NAME", multiversion_default_ref),
- relative_url,
- sep = "/"
- )
- }
- return(link(text, url))
-}
-# Other variables
-admiral_homepage <- "https://pharmaverse.github.io/admiral"
library(admiraldev)
```
@@ -371,6 +344,4 @@ adbcva <- adbcva %>%
ADaM | Sample Code
---- | --------------
- ADBCVA | `r dyn_link("ad_adbcva.R", "https://github.com/pharmaverse/admiralophtha/blob", "inst/templates/ad_adbcva.R", is_multiversion = TRUE)`
-
-
+ ADBCVA | [ad_adbcva.R](https://github.com/pharmaverse/admiralophtha/blob/main/inst/templates/ad_adbcva.R)
diff --git a/vignettes/admiralophtha.Rmd b/vignettes/admiralophtha.Rmd
index 13e052fe..a23a93f3 100644
--- a/vignettes/admiralophtha.Rmd
+++ b/vignettes/admiralophtha.Rmd
@@ -12,39 +12,12 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
-link <- function(text, url) {
- return(
- paste0(
- "[", text, "]",
- "(", url, ")"
- )
- )
-}
-dyn_link <- function(text,
- base_url,
- relative_url = "",
- # Change to TRUE when admiral adopts multiversion docs
- is_multiversion = FALSE,
- multiversion_default_ref = "main") {
- url <- paste(base_url, relative_url, sep = "/")
- if (is_multiversion) {
- url <- paste(
- base_url,
- Sys.getenv("BRANCH_NAME", multiversion_default_ref),
- relative_url,
- sep = "/"
- )
- }
- return(link(text, url))
-}
-# Other variables
-admiral_homepage <- "https://pharmaverse.github.io/admiral/cran-release"
```
# Introduction
As this is a package extension, if you are new to `{admiral}` then the best place to first start
-reading would be this `r dyn_link("Get Started", admiral_homepage, "articles/admiral.html")`
+reading would be this [Get Started](https://pharmaverse.github.io/admiral/articles/admiral.html)
guide. This extension package follows the same main idea and conventions, and re-uses many
functions from `{admiral}`, so it is important to thoroughly understand these to be able to
use `{admiralophtha}`.
diff --git a/vignettes/adoe.Rmd b/vignettes/adoe.Rmd
index 38e072b3..4a72328a 100644
--- a/vignettes/adoe.Rmd
+++ b/vignettes/adoe.Rmd
@@ -13,33 +13,6 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
-link <- function(text, url) {
- return(
- paste0(
- "[", text, "]",
- "(", url, ")"
- )
- )
-}
-dyn_link <- function(text,
- base_url,
- relative_url = "",
- # Change to TRUE when admiral adopts multiversion docs
- is_multiversion = FALSE,
- multiversion_default_ref = "main") {
- url <- paste(base_url, relative_url, sep = "/")
- if (is_multiversion) {
- url <- paste(
- base_url,
- Sys.getenv("BRANCH_NAME", multiversion_default_ref),
- relative_url,
- sep = "/"
- )
- }
- return(link(text, url))
-}
-# Other variables
-admiral_homepage <- "https://pharmaverse.github.io/admiral"
library(admiraldev)
```
@@ -143,5 +116,5 @@ The user is invited to consult the article on [creating a BDS dataset from SDTM]
ADaM | Sample Code
---- | --------------
-ADOE | `r dyn_link("ad_adoe.R", "https://github.com/pharmaverse/admiralophtha/blob", "inst/templates/ad_adoe.R", is_multiversion = TRUE)`
+ADOE | [ad_adoe.R](https://github.com/pharmaverse/admiralophtha/blob/main/inst/templates/ad_adoe.R)
diff --git a/vignettes/advfq.Rmd b/vignettes/advfq.Rmd
index 8a8751c4..d0b67aa5 100644
--- a/vignettes/advfq.Rmd
+++ b/vignettes/advfq.Rmd
@@ -13,33 +13,6 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
-link <- function(text, url) {
- return(
- paste0(
- "[", text, "]",
- "(", url, ")"
- )
- )
-}
-dyn_link <- function(text,
- base_url,
- relative_url = "",
- # Change to TRUE when admiral adopts multiversion docs
- is_multiversion = FALSE,
- multiversion_default_ref = "main") {
- url <- paste(base_url, relative_url, sep = "/")
- if (is_multiversion) {
- url <- paste(
- base_url,
- Sys.getenv("BRANCH_NAME", multiversion_default_ref),
- relative_url,
- sep = "/"
- )
- }
- return(link(text, url))
-}
-# Other variables
-admiral_homepage <- "https://pharmaverse.github.io/admiral"
```
# Introduction
@@ -245,4 +218,5 @@ advfq <- advfq %>%
ADaM | Sample Code
---- | --------------
-ADVFQ | `r dyn_link("ad_advfq.R", "https://github.com/pharmaverse/admiralophtha/blob", "inst/templates/ad_advfq.R", is_multiversion = TRUE)`
+ADVFQ | [ad_advfq.R](https://github.com/pharmaverse/admiralophtha/blob/main/inst/templates/ad_advfq.R)
+
diff --git a/vignettes/articles/website-versions.Rmd b/vignettes/articles/website-versions.Rmd
new file mode 100644
index 00000000..378214e3
--- /dev/null
+++ b/vignettes/articles/website-versions.Rmd
@@ -0,0 +1,82 @@
+---
+title: "Previous Versions of Website"
+---
+
+```{r, include = FALSE}
+# TO USE THIS ARTICLE, THE DESCRIPTION FILE MUST INCLUDE
+# Config/Needs/website: gert
+# Make sure to copy the gh-pages branch to your local git
+
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+```
+
+```{r setup, include=FALSE}
+base_url <-
+ "https://pharmaverse.github.io/admiralophtha/" # include the trailing backslash!
+
+# get list of all files in the `gh-pages` branch
+df_all_files <- tryCatch(gert::git_ls(ref = "gh-pages"), error = function(x) FALSE)
+
+# if a local user (not on CI) does not have a copy of the `gh-pages` branch, exit silently
+if (!isTRUE(as.logical(Sys.getenv("CI"))) && isFALSE(df_all_files)) {
+ knitr::knit_exit()
+}
+```
+
+```{r include=FALSE}
+# extract all folders in the root of the branch
+all_folders <-
+ sub("/.*", "", df_all_files$path)[grepl(
+ x = df_all_files$path,
+ pattern = "/",
+ fixed = TRUE
+ )] |>
+ unique()
+
+# subset to all version folders
+all_version_folders <-
+ all_folders[grep("^v[0-9]+|dev", x = all_folders)] |>
+ rev()
+# more dev first if it appears
+if ("dev" %in% all_version_folders) {
+ all_version_folders <- c("dev", all_version_folders) |> unique()
+}
+
+# release dates of prior tags
+df_tags <- gert::git_tag_list()
+df_tags <- df_tags[df_tags$name %in% all_version_folders, ]
+df_tags$date <-
+ lapply(
+ df_tags$commit,
+ FUN = function(x) {
+ tryCatch(
+ gert::git_commit_info(ref = x)$time |> as.Date() |> as.character(),
+ error = function(x) NA
+ )
+ }
+ ) |>
+ unlist()
+df_tags <- df_tags[!is.na(df_tags$date), ]
+
+lst_tag_dates <-
+ paste0(" (", df_tags$date, ")") |>
+ as.list() |>
+ setNames(df_tags$name)
+
+# string with all markdown links
+str_website_links <-
+ lapply(
+ X = all_version_folders,
+ FUN = function(x) {
+ x_label <- ifelse(x %in% "dev", "Development Site", x)
+ paste0("[", x_label, lst_tag_dates[[x]], "](", paste0(base_url, x), ")")
+ }
+ ) |>
+ unlist() |>
+ paste(collapse = "\n\n")
+```
+
+`r str_website_links`
diff --git a/vignettes/standards.Rmd b/vignettes/standards.Rmd
index da2b4aff..bfaab5f8 100644
--- a/vignettes/standards.Rmd
+++ b/vignettes/standards.Rmd
@@ -13,33 +13,6 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
-link <- function(text, url) {
- return(
- paste0(
- "[", text, "]",
- "(", url, ")"
- )
- )
-}
-dyn_link <- function(text,
- base_url,
- relative_url = "",
- # Change to TRUE when admiral adopts multiversion docs
- is_multiversion = FALSE,
- multiversion_default_ref = "main") {
- url <- paste(base_url, relative_url, sep = "/")
- if (is_multiversion) {
- url <- paste(
- base_url,
- Sys.getenv("BRANCH_NAME", multiversion_default_ref),
- relative_url,
- sep = "/"
- )
- }
- return(link(text, url))
-}
-# Other variables
-admiral_homepage <- "https://pharmaverse.github.io/admiral"
library(admiraldev)
```