Skip to content

Commit

Permalink
example of writing chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
kweav committed Jan 7, 2025
1 parent f2ead62 commit 6270555
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions echo_chunks.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env Rscript

write_header <- function(cheatsheet_title, cheatsheet_subtitle){
return(paste0('---\ntitle: |\n <center> <u>', cheatsheet_title, '</u></center>\n <center> <p style = "color:#986753;">', cheatsheet_subtitle, '</p></center>\ndate: "Last updated: `r format(Sys.time(), \'%B %d, %Y\')`"\noutput: html_document\ncss: style.css\n---'))
}

write_use_template <- function(template_name, template_url){
return(paste0('\n\n## Create your OTTR repository from the [', template_name, ' repository](', template_url, ')\n\n<input type="checkbox"> In the upper right, _click on_: <div class = "github_button"><a href="https://github.com/new?template_name=', template_name, '&template_owner=jhudsl"> Use this template</a></div>\n\n<input type="checkbox"> Set your repo to **Public**'))
}
15 changes: 15 additions & 0 deletions website_setup_test_chunks.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: |
<center> <u>OTTR Websites</u></center>
<center> <p style = "color:#986753;">Setup</p></center>
date: "Last updated: `r format(Sys.time(), '%B %d, %Y')`"
output: html_document
css: style.css
---


## Create your OTTR repository from the [OTTR_Template_Website repository](https://github.com/jhudsl/OTTR_Template_Website)

<input type="checkbox"> In the upper right, _click on_: <div class = "github_button"><a href="https://github.com/new?template_name=OTTR_Template_Website&template_owner=jhudsl"> Use this template</a></div>

<input type="checkbox"> Set your repo to **Public**
9 changes: 9 additions & 0 deletions write_cheatsheets.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env Rscript

library(here)
library(tidyverse)
source(here("echo_chunks.R"))

c(write_header("OTTR Websites", "Setup"),
write_use_template("OTTR_Template_Website", "https://github.com/jhudsl/OTTR_Template_Website")
) %>% write_lines(here("website_setup_test_chunks.Rmd"))

0 comments on commit 6270555

Please sign in to comment.