Skip to content

Commit

Permalink
Adding in help and test files
Browse files Browse the repository at this point in the history
  • Loading branch information
dmkaplan2000 committed Jun 7, 2022
1 parent 842bf8f commit 9733376
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
25 changes: 25 additions & 0 deletions R/starticles.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#' A Generic, Publisher-Independent Template for Writing Scientific Documents in
#' 'rmarkdown'
#'
#' This package provides a 'rmarkdown' template for authoring scientific documents
#' that is publisher independent. Though the template can be used by itself
#' for many types of scientific documents and likely for submitting publications
#' to many journals, it is primarily intended as a starter format for writing a
#' scientific publication before one has chosen a specific target journal.
#' Once an article has been written, the format can be quickly adapted for use
#' with the [rticles][rticles::oup_article()] package. See the package vignette
#' for more details.
#'
#' \tabular{ll}{ Package: \tab starticles\cr Type: \tab Package\cr Version:
#' \tab 0.1\cr Date: \tab 2022-06-07\cr License: \tab GPL (>= 3)\cr }
#'
#' @author David M. Kaplan \email{dmkaplan2000@@gmail.com}
#'
#' @name starticles
#' @docType package
#' @title A Generic, Publisher-Independent Template for Writing Scientific Documents in 'rmarkdown'
#' @keywords package
#' @example tests/test.starticles.R
#'
#' @seealso `browseVignettes("starticles")`, [rmarkdown][rmarkdown::rmarkdown-package()], [rticles][rticles::oup_article()]
NULL
53 changes: 53 additions & 0 deletions man/starticles.Rd

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

21 changes: 21 additions & 0 deletions tests/test.starticles.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use a temporary directory ----------------------------
owd = getwd()
td = tempfile()
dir.create(td,recursive=TRUE)
setwd(td)
print(td) # To see where files will be

# Create the draft template ----------------------------
rmarkdown::draft("MYARTICLENAME.Rmd","generic_article","starticles",edit=FALSE)

# Render PDF document ----------------------------------
# Fails for me when run using RStudio "Run examples" link in help,
# but not when sourced from command line.

# Requires recent version of pandoc (provided by RStudio)
if (rmarkdown::pandoc_available(version="2.17"))
rmarkdown::render("MYARTICLENAME/MYARTICLENAME.Rmd",
envir=new.env(parent = globalenv()))

# Return to orignal workind directory ------------------
setwd(owd)

0 comments on commit 9733376

Please sign in to comment.