-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
discussiondocumentationImprovements or additions to documentationImprovements or additions to documentation
Description
Please select a category the issue is focused on?
User Guides
Let us know where something needs a refresh or put your idea here!
Should we have a separate page which shows the code of all tempates?
@manciniedoardo has created one for admiralroche which could be adapted easily:
---
title: "Explore the admiralroche ADaM Templates"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Explore the admiralroche ADaM Templates}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# Introduction {#intro}
This page is a catalog of the ADaM templates available through `{admiralroche}`. These are lifted from our GitLab repository. The intention is for this to be a reference for users, should they wish to peruse the code of a specific template without visiting the `{admiralroche}` repository.
As a reminder, you can create a starter script from a template using `admiral::use_ad_template()`, e.g.,
```{r eval=FALSE}
use_ad_template(
adam_name = "adsl",
save_path = "./ad_adsl.R",
package = "admiralroche"
)
```
# ADaM templates {#templates}
```{r, results='asis', echo=FALSE}
template_files <- list.files(
here::here("inst", "templates"),
pattern = "\\.R$",
full.names = TRUE
)
for (file_path in template_files) {
file_name <- basename(file_path)
code_content <- readLines(file_path, warn = FALSE)
# Escape characters like < and > in the code to prevent them from breaking vignette
escaped_code <- htmltools::htmlEscape(paste(code_content, collapse = "\n"))
# Construct collapsible block
cat(paste0(
"<details style='margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; padding: 5px;'>\n",
" <summary style='cursor: pointer; font-weight: bold;'>", file_name, "</summary>\n",
" <pre style='max-height: 90vh'><code>", escaped_code, "</code></pre>\n",
"</details>\n\n"
))
}
```
Metadata
Metadata
Assignees
Labels
discussiondocumentationImprovements or additions to documentationImprovements or additions to documentation
Type
Projects
Status
Backlog