Skip to content

Commit

Permalink
Merge pull request #27 from jonmcalder/master
Browse files Browse the repository at this point in the history
Add xaringan slide engine (plus related updates)
  • Loading branch information
stephlocke committed May 13, 2017
2 parents 57a3605 + e0ab9c2 commit 752d3e1
Show file tree
Hide file tree
Showing 8 changed files with 522 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pRojects
Title: Manage Project Directories for R Projects
Version: 0.0.1.9002
Version: 0.0.1.9003
Authors@R: c(
person("Steph", "Locke", email = "steph@itsalocke.com", role = c("aut", "cre")),
person("Jon", "Calder", email = "jonmcalder@gmail.com", role = "aut")
Expand Down
18 changes: 14 additions & 4 deletions R/createTrainingProject.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ createTrainingProject <- function(name,
slideEngine = "rmarkdown",
...) {
# Supported packages
handoutEngine <-
match.arg(handoutEngine, c("rmarkdown", "bookdown", "tufte"))
slideEngine <- match.arg(slideEngine, c("rmarkdown", "revealjs"))
handoutEngine <- match.arg(handoutEngine, c("rmarkdown", "bookdown", "tufte"))
slideEngine <- match.arg(slideEngine, c("rmarkdown", "revealjs", "xaringan"))

# Installation dir
usePackrat <- !methods::hasArg("packrat")
Expand Down Expand Up @@ -54,7 +53,18 @@ createTrainingProject <- function(name,

# Slides prep
if ("slides" %in% dirs) {
devtools:::add_desc_package(name,"Imports",slideEngine)
devtools:::add_desc_package(name, "Imports", slideEngine)

if (slideEngine != "rmarkdown") {
message(paste(slideEngine, "demo added"))
file.copy(
list.files(system.file("templates", slideEngine, package = "pRojects"), full.names = TRUE),
file.path(name, "slides"),
overwrite = TRUE,
recursive = TRUE
)
}

}

if (usePackrat) {
Expand Down
6 changes: 3 additions & 3 deletions R/shinyGadget.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ projectGadget <- function() {
shiny::inputPanel(
shiny::selectInput(
"projectType", label = "Project Type",
choices = c("Basic","Analysis","Package","Training"),
choices = c("Basic", "Analysis", "Package", "Training"),
selected = "Basic"
),
shiny::textInput("name", "Project Name")
Expand Down Expand Up @@ -57,10 +57,10 @@ projectGadget <- function() {
selected = c("data", "handouts", "slides"),
multiple = TRUE),
shiny::radioButtons("handoutE", label = "Handouts",
choices=c("rmarkdown","bookdown","tufte"),
choices = c("rmarkdown", "bookdown", "tufte"),
selected = "rmarkdown"),
shiny::radioButtons("slideE", label = "Slides",
choices=c("rmarkdown","revealjs"),
choices = c("rmarkdown", "revealjs", "xaringan"),
selected = "rmarkdown")
)

Expand Down
37 changes: 37 additions & 0 deletions inst/templates/revealjs/revealjs_slides.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "revealjs slides"
output:
revealjs::revealjs_presentation:
self_contained: true
theme: sky
highlight: pygments
center: true
transition: fade
reveal_options:
slideNumber: true
previewLinks: true
---

## R Markdown

This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Code and Output

```{r}
summary(cars)
```

## Slide with Plot

```{r, echo=FALSE}
plot(cars)
```
File renamed without changes.
Loading

0 comments on commit 752d3e1

Please sign in to comment.