Skip to content

Commit

Permalink
Merge pull request #60 from aghaynes/master
Browse files Browse the repository at this point in the history
CTUtemplate 0.6.1
  • Loading branch information
aghaynes authored Feb 27, 2025
2 parents d994969 + 03a43d6 commit 18ca017
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Package: CTUtemplate
Title: Example RStudio Project Templates
Author: Alan G. Haynes
Maintainer: Alan G. Haynes <[email protected]>
Version: 0.6.0
Version: 0.6.1
Description: Templates and functions for use in CTU Bern.
Depends:
R (>= 3.3.2)
License: GPL (>= 2)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Imports:
bookdown,
fs,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(use_qmd_html)
export(use_qmd_htmlrecruitment)
export(use_qmd_htmlsampsi)
export(use_qmd_pres)
export(use_qmd_typst)
export(use_quarto)
export(use_recreport_template)
export(use_report_template)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
CTUtemplate 0.6.1
---------------------
addition of use_qmd_typst

CTUtemplate 0.6.0
---------------------
update templates to use DCR-like branding
Expand Down
24 changes: 23 additions & 1 deletion R/use_.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,27 @@ use_qmd_htmlsampsi <- function(save_in = ".", open = TRUE){

}

#' Use the CTU quarto typst template
#' This function will download and optionally open the quarto markdown (qmd) file
#' and the other necessary files from github.
#' @describeIn use_qmd Sample Size Report Template
#' @param save_in directory to save the main qmd in
#' @param open logical indicating whether to open the file
#' @export
#' @examples
#' # dir <- tempdir()
#' # file <- file.path(dir, "filename.qmd")
#' # use_qmd_html(file, FALSE)
#' # in practice at CTU:
#' # use_qmd_typst("08_Reports_xx/ReportName.qmd", TRUE)
use_qmd_typst <- function(save_in = ".", open = TRUE){

if_no_ping_stop()

use_quarto("typst", save_in, open = open)

}



#' Get a quarto template from the CTU-Bern quarto repository
Expand All @@ -297,14 +318,15 @@ use_qmd_htmlsampsi <- function(save_in = ".", open = TRUE){
#' #use_quarto("html", ".")
use_quarto <- function(x, dir, open = TRUE){

if(!x %in% c("html", "html-ss", "html-rec", "pres")){
if(!x %in% c("html", "html-ss", "html-rec", "pres", "typst")){
stop("unknown branch of CTU-Bern/quarto")
}

wd <- getwd()
on.exit(setwd(wd))

setwd(dir)
if(length(list.files()) > 0) stop("'dir' is not empty - an empty 'dir' is necessary")

system(glue("quarto use template CTU-Bern/quarto@{x} --no-prompt"))

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# `CTUtemplate` <img src='man/figures/sticker.png' align="right" width="200">

[![](https://img.shields.io/badge/dev%20version-0.6.0-blue.svg)](https://github.com/CTU-Bern/CTUtemplate)
[![](https://img.shields.io/badge/dev%20version-0.6.1-blue.svg)](https://github.com/CTU-Bern/CTUtemplate)

`CTUtemplate` is a package to create a template directory structure (and
files) and also includes the CTUs annual safety report function.
Expand Down
14 changes: 14 additions & 0 deletions man/use_qmd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 18ca017

Please sign in to comment.