Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inst/doc
.Rproj.user
.Rhistory
.RData
.txt
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Package: dscoemarkdown
Title: R Markdown for DSCOE Submissions
Version: 0.0.0.9000
Version: 0.0.1.0
Authors@R: person("Ian", "Kloo", email = "ian.p.kloo.civ@mail.mil", role = c("aut", "cre"))
Description: Create R Markdown documents in the prefered format for the DSCOE
website.
Depends:
R (>= 2.0.0)
R (>= 3.5.0)
License: None
Encoding: UTF-8
LazyData: true
RoxygenNote: 5.0.1
RoxygenNote: 7.1.0
Imports: knitr,
rmarkdown
VignetteBuilder: knitr

71 changes: 55 additions & 16 deletions R/dscoemarkdown_function.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,65 @@
#' Run Markdown
#' @title Generate DSCOE markdown
#'
#'
#' @description Apply css and footer and build a DSCOE formatted markdown document
#'
#' @param logo a boolean representing whether or not to inclue the DSCOE logo
#' @param disclaimer a boolean representing whether or not to include the disclaimer footer
#'
#' @examples
#' ---
#' #title: "Demo Header"
#' #author: "Ian Kloo"
#' #date: "September 2016"
#' #output: dscoemarkdown::dscoe
#' ---
#'
#' ---
#' #title: "Demo Header"
#' #author: "Ian Kloo"
#' #date: "September 2016"
#' #output:
#' # dscoemarkdown::dscoe:
#' # logo: FALSE
#' # disclaimer: FALSE
#' ---
#'
#' @export
#'
#'

dscoe <- function(logo=TRUE, disclaimer=TRUE) {
system <- system.file('',package='dscoemarkdown')

if(disclaimer == TRUE){
footer <- paste(system,'/style/disclaimer.html',sep='')
} else if(disclaimer == FALSE){
footer <- paste(system,'/style/noDisclaimer.html',sep='')
}

if(logo == TRUE){
css <- paste(system,'/style/dscoemarkdownLogo.css',sep='')
} else if(logo == FALSE){
css <- paste(system,'/style/dscoemarkdownNoLogo.css',sep='')

if(.Platform$OS.type == 'windows'){

if(disclaimer == TRUE){
footer <- paste(system,'/style/disclaimer.html',sep='')
} else if(disclaimer == FALSE){
footer <- paste(system,'/style/noDisclaimer.html',sep='')
}

if(logo == TRUE){
css <- paste(system,'/style/dscoemarkdownLogo.css',sep='')
} else if(logo == FALSE){
css <- paste(system,'/style/dscoemarkdownNoLogo.css',sep='')
}

} else if (.Platform$OS.type == "unix") {

if(disclaimer == TRUE){
footer <- paste(system,'style/disclaimer.html',sep='')
} else if(disclaimer == FALSE){
footer <- paste(system,'style/noDisclaimer.html',sep='')
}

if(logo == TRUE){
css <- paste(system,'style/dscoeMarkdownLogo.css',sep='')
} else if(logo == FALSE){
css <- paste(system,'style/dscoeMarkdownNoLogo.css',sep='')
}

}




rmarkdown::html_document(css=css, includes=rmarkdown::includes(after_body=footer))

}
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ require(devtools)
devtools::install_github("iankloo/dscoemarkdown")
```

***There is a known issue with linux users. Until I can get a more elgant fix, you can use the following lines to install the package on linux:

```{r}
require(devtools)
devtools::install_github("iankloo/dscoemarkdown", ref = 'linux')
```

If that goes smoothly, you can now include this line in the header of your R Markdown Documents:

```{r}
Expand Down Expand Up @@ -67,5 +60,5 @@ As it stands, the styling in this package is very basic. If you want to propose

## Example

![alt tag](https://github.com/iankloo/dscoemarkdown/blob/master/dscoeMarkdownExample.png)
![alt tag](./inst/dscoeMarkdownExample.png)

10 changes: 7 additions & 3 deletions dscoemarkdown.Rproj → dscoemarkdown2.Rproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
Version: 1.0

RestoreWorkspace: No
SaveWorkspace: No
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
File renamed without changes
29 changes: 26 additions & 3 deletions man/dscoe.Rd

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

2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
83 changes: 83 additions & 0 deletions vignettes/DSCOE-Markdown.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: "DSCOE-Markdown"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{DSCOE-Markdown}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```

```{r setup}
library(dscoemarkdown)
```

# DSCOE Markdown Package

This package was created for DSCOE products in order to unify formatting.

Using this package, you can extend knitr to automatically use the DSCOE format.

## Usage

You can install this package using the devtools github installer:

```{r eval=FALSE}
require(devtools)
devtools::install_github("iankloo/dscoemarkdown")
```

If that goes smoothly, you can now include this line in the header of your R Markdown Documents:

```{r eval=FALSE}
output: dscoemarkdown::dscoe
```

An example full header is:

```{r eval=FALSE}
---
title: "Demo Header"
author: "Ian Kloo"
date: "September 2016"
output: dscoemarkdown::dscoe
---
```

## Styling

The base styling comes from <a href='https://edwardtufte.github.io/tufte-css/'>Edward Tufte's github page</a>. Tufte is known for simple and readable aesthetics, so this was a good place to start.

This styling is very simple, in that it does not require any javascript libraries (such as jQuery) to do the styling. These libraries make it much more difficult to share/post documents. You may still need to include javascript libraries as part of your work, but at least there won't be any additional libraries needed for styling alone.

## Options

You have the option to remove the DSCOE logo and/or the disclaimer. We ask that you leave these on for DSCOE posts, but if you want to use the framework elsewhere, please feel free to remove them.

By default, both the logo and disclaimer are included. To change this you can specify options like this:

```{r eval=FALSE}
---
title: "DSCOE Markdown Example"
author: "Ian Kloo"
date: "September 2016"
output:
dscoemarkdown::dscoe:
logo: FALSE
disclaimer: FALSE
---
```

## Development

As it stands, the styling in this package is very basic. If you want to propose any changes, make an "issue" or clone the repo and push your own branch.

## Example

![alt tag](../inst/dscoeMarkdownExample.png)