소스 검색

Initial commit

master
Garrick Aden-Buie 7 년 전
커밋
1b72467243
15개의 변경된 파일512개의 추가작업 그리고 0개의 파일을 삭제
  1. +2
    -0
      .Rbuildignore
  2. +25
    -0
      .Rhistory
  3. +1
    -0
      .gitignore
  4. +15
    -0
      DESCRIPTION
  5. +3
    -0
      NAMESPACE
  6. +23
    -0
      R/bulma_document.R
  7. +21
    -0
      bulmaRmd.Rproj
  8. +1
    -0
      inst/bulma/bulma.0.7.2.min.css
  9. +137
    -0
      inst/bulma/bulma.html
  10. +48
    -0
      inst/rmarkdown/templates/bulma_document/skeleton.Rmd
  11. +4
    -0
      inst/rmarkdown/templates/bulma_document/template.yaml
  12. +46
    -0
      man/bulma_document.Rd
  13. +18
    -0
      tests/manual/bibfile.bib
  14. +165
    -0
      tests/manual/bulma-test.Rmd
  15. +3
    -0
      tests/manual/custom.css

+ 2
- 0
.Rbuildignore 파일 보기

@@ -0,0 +1,2 @@
^bulmaRmd\.Rproj$
^\.Rproj\.user$

+ 25
- 0
.Rhistory 파일 보기

@@ -0,0 +1,25 @@
download.file("https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css", "inst/bulma/bulma.0.7.2.min.css")
rmarkdown:::pandoc_options(args = "--template something")
download.file("https://raw.githubusercontent.com/ijlyttle/user2016_knitr/master/Part1/1_PandocMarkdown/pandoc-markdown.bib", "tests/manual/bibfile.bib")
use_r("bulma_document")
rmarkdown::html_document
rmarkdown:::rmarkdown_system_file
use_package("rmarkdown")
library(bulmaRmd)
library(bulmaRmd)
library(bulmaRmd)
library(bulmaRmd)
library(bulmaRmd)
system.file("inst", "bulma", "bulma.html", package="bulmaRmd")
library(bulmaRmd)
system.file("inst", "bulma", "bulma.html", package="bulmaRmd")
system.file("bulma", package="bulmaRmd")
system.file("bulma", "bulma.html", package="bulmaRmd")
library(bulmaRmd)
library(bulmaRmd)
library(bulmaRmd)
c("--css", c("a", "b"))
library(bulmaRmd)
library(bulmaRmd)
library(bulmaRmd)
usethis:::restart_rstudio()

+ 1
- 0
.gitignore 파일 보기

@@ -0,0 +1 @@
.Rproj.user

+ 15
- 0
DESCRIPTION 파일 보기

@@ -0,0 +1,15 @@
Package: bulmaRmd
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person(given = "Garrick",
family = "Aden-Buie",
role = c("aut", "cre"),
email = "g.adenbuie@gmail.com")
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Imports:
rmarkdown
RoxygenNote: 6.1.1

+ 3
- 0
NAMESPACE 파일 보기

@@ -0,0 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(bulma_document)

+ 23
- 0
R/bulma_document.R 파일 보기

@@ -0,0 +1,23 @@
#' Bulma Document Renderer
#'
#' @inheritDotParams rmarkdown::html_document_base
#' @export
bulma_document <- function(..., css = NULL, pandoc_args = NULL) {
css_files <- c(
"--css", system.file("bulma", "bulma.0.7.2.min.css", package="bulmaRmd"))

if (!is.null(css)) {
for (file in css) {
css_files <- c(css_files, "--css", file)
}
}
rmarkdown::html_document_base(
pandoc_args = c(
css_files,
pandoc_args,
"--template",
system.file("bulma", "bulma.html", package="bulmaRmd")
),
...
)
}

+ 21
- 0
bulmaRmd.Rproj 파일 보기

@@ -0,0 +1,21 @@
Version: 1.0

RestoreWorkspace: No
SaveWorkspace: No
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

+ 1
- 0
inst/bulma/bulma.0.7.2.min.css
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 137
- 0
inst/bulma/bulma.html 파일 보기

@@ -0,0 +1,137 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="$lang$" xml:lang="$lang$"$if(dir)$ dir="$dir$"$endif$>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$
$if(date-meta)$
<meta name="dcterms.date" content="$date-meta$" />
$endif$
$if(keywords)$
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
$if(quotes)$
q { quotes: "“" "”" "‘" "’"; }
$endif$
</style>
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
<style type="text/css" charset="utf-8">
body {
font-family: "Fira Sans", "Helvetica Neue", Roboto, sans-serif;
}
pre, code {
font-family: "Fira Mono", "Roboto Mono", monospace;
}
.content table {
width: auto;
margin: auto;
}
.tabs-content li {
display: none;
list-style: none;
}
.tabs-content li.is-active {
display: block;
}
</style>
$for(css)$
<link rel="stylesheet" href="$css$" />
$endfor$
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
<section class="hero$if(bulma.hero)$$for(bulma.hero)$ is-$bulma.hero$$endfor$$else$ is-primary$endif$">
<div class="hero-body">
<div class="container">
$if(title)$
<h1 class="title is-1 toc-ignore">$title$</h1>
$endif$
$if(subtitle)$
<h1 class="subtitle is-3 toc-ignore"><em>$subtitle$</em></h1>
$endif$
$if(header-links)$
$for(header-links)$
<a class="button is-primary is-inverted is-outlined" href="$header-links.url$">$header-links.name$</a>
$endfor$
$endif$ <!-- header-links -->
</div>
</div>
</section>

<section class="section">
<div class="container">
<div class="content" id="content-body">
$if(author)$
<div class="level">
$for(author)$
<div class="level-item has-text-centered">
<div>
$if(author.name)$
<p class="title is-5">
$if(author.url)$
<a href="$author.url$">$author.name$</a>
$else$
$author.name$
$endif$
</p>
$endif$
$if(author.extra)$
<p class="subtitle is-6">
$for(author.extra)$$author.extra$$sep$<br>$endfor$
</p>
$endif$
</div>
</div>
$endfor$
</div>
$endif$

$body$

</div>
</div>
</section>

$for(include-after)$
$include-after$
$endfor$
<script>
// add bulma table styles to pandoc tables
document.addEventListener("DOMContentLoaded", function(event) {
var tableClasses = ["table", "is-striped", "is-hoverable"];
var tables = document.getElementById('content-body').getElementsByTagName("table");
for (var i = 0; i < tables.length; i++) {
tables[i].classList.add(...tableClasses);
}
})
</script>
$if(mathjax-url)$
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "$mathjax-url$";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
$endif$

</body>
</html>

+ 48
- 0
inst/rmarkdown/templates/bulma_document/skeleton.Rmd 파일 보기

@@ -0,0 +1,48 @@
---
title: "Title"
subtitle: "A minimal Bulma RMarkdown Template"
author:
- name: First Author
url: https://rstudio.com
extra:
- "First Affiliation"
- "&commat;tweeter345"
- name: Second Author
url: https://duckduckgo.com
extra:
- "Second Affiliation"
- "Very Cool Guy"
date: '`r strftime(Sys.time(), "%F %T")`'
header-links:
- name: Github
url: https://github.com/gerkelab
- name: Home
url: https://gerkelab.com
bulma:
hero: ["info", "bold"]
output: bulmaRmd::bulma_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. 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. You can embed an R code chunk like this:

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

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

+ 4
- 0
inst/rmarkdown/templates/bulma_document/template.yaml 파일 보기

@@ -0,0 +1,4 @@
name: Bulma Document
description: >
Template for documents to be published as Bulma Markdown Documents.
create_dir: false

+ 46
- 0
man/bulma_document.Rd 파일 보기

@@ -0,0 +1,46 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bulma_document.R
\name{bulma_document}
\alias{bulma_document}
\title{Bulma Document Renderer}
\usage{
bulma_document(..., css = NULL, pandoc_args = NULL)
}
\arguments{
\item{...}{Arguments passed on to \code{rmarkdown::html_document_base}
\describe{
\item{smart}{Produce typographically correct output, converting straight
quotes to curly quotes, --- to em-dashes, -- to en-dashes, and ... to
ellipses.}
\item{theme}{Visual theme ("default", "cerulean", "journal", "flatly",
"readable", "spacelab", "united", "cosmo", "lumen", "paper", "sandstone",
"simplex", or "yeti"). Pass \code{NULL} for no theme (in this case you can
use the \code{css} parameter to add your own styles).}
\item{self_contained}{Produce a standalone HTML file with no external
dependencies, using data: URIs to incorporate the contents of linked
scripts, stylesheets, images, and videos. Note that even for self contained
documents MathJax is still loaded externally (this is necessary because of
its size).}
\item{lib_dir}{Directory to copy dependent HTML libraries (e.g. jquery,
bootstrap, etc.) into. By default this will be the name of the document with
\code{_files} appended to it.}
\item{mathjax}{Include mathjax. The "default" option uses an https URL from a
MathJax CDN. The "local" option uses a local version of MathJax (which is
copied into the output directory). You can pass an alternate URL or pass
\code{NULL} to exclude MathJax entirely.}
\item{pandoc_args}{Additional command line options to pass to pandoc}
\item{template}{Pandoc template to use for rendering. Pass "default" to use
the rmarkdown package default template; pass \code{NULL} to use pandoc's
built-in template; pass a path to use a custom template that you've created.
Note that if you don't use the "default" template then some features of
\code{html_document} won't be available (see the Templates section below for
more details).}
\item{dependency_resolver}{A dependency resolver}
\item{copy_resources}{Copy resources}
\item{extra_dependencies}{Extra dependencies}
\item{bootstrap_compatible}{Bootstrap compatible}
}}
}
\description{
Bulma Document Renderer
}

+ 18
- 0
tests/manual/bibfile.bib 파일 보기

@@ -0,0 +1,18 @@
@Book{xie2015,
title = {Dynamic Documents with {R} and knitr},
author = {Yihui Xie},
publisher = {Chapman and Hall/CRC},
address = {Boca Raton, Florida},
year = {2015},
edition = {2nd},
note = {ISBN 978-1498716963},
url = {http://yihui.name/knitr/},
}
@Manual{R-base,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2016},
url = {https://www.R-project.org/},
}

+ 165
- 0
tests/manual/bulma-test.Rmd 파일 보기

@@ -0,0 +1,165 @@
---
title: "Bulma Test"
subtitle: "A minimal Bulma RMarkdown Template"
author:
- name: Garrick Aden-Buie
url: https://garrickadenbuie.com
extra:
- "Moffitt Cancer Center"
- "[&commat;grrrck](https://twitter.com/grrrck)"
- name: Travis Gerke
url: https://travisgerke.com
extra:
- "Moffitt Cancer Center"
- "&commat;travisgerke"
date: "12/7/2018"
header-links:
- name: Github
url: https://github.com/gerkelab
- name: Home
url: https://gerkelab.com
# bulma:
# hero: ["dark", "bold"]
output:
bulmaRmd::bulma_document: default
# css: custom.css
html_document_base:
pandoc_args: ["--template", "/Users/4468739/work/bulmaRmd/inst/bulma/bulma-min.html" ]
md_document: default
bibliography: bibfile.bib
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

<!--
<div class="level">
<div class="level-item has-text-centered">
<div>
<p class="title is-5">Garrick Aden-Buie</p>
<p class="subtitle is-6">Moffitt Cancer Center<br>&commat;grrrck<br>garrickadenbuie.com</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="title is-5">Travis Gerke</p>
<p class="subtitle is-6">Moffitt Cancer Center<br>&commat;travisgerke<br>travisgerke.com</p>
</div>
</div>
</div>
-->

A bit of an _introduction_ here. We no longer need to start an article by writing this:

```latex
\documentclass{article}
\begin{document}
\end{document}
```

# Start with a cool section

You can use traditional **Markdown** syntax, such as [links](http://yihui.name/knitr) and `code`. Here is a quote:

> A girl phoned me the other day and said "Come on over, there's nobody home." I went over. Nobody was home. -- Rodney Dangerfield

# Followed by another section

Of course you can write lists:

- apple
- pear
- banana

Or ordered lists:

1. items
1. will
1. be
1. ordered
- nested
- items

# Okay, some R code

```{r linear-model}
fit = lm(dist ~ speed + I(speed^2), data = cars)
b = coef(fit) # coefficients
summary(fit)
```

The code will be highlighted in all output formats.

# And some pictures

```{r lm-vis, fig.cap='Regression diagnostics', fig.height=5}
par(mfrow = c(2, 2), pch = 20, mar = c(4, 4, 2, .1), bg = 'white')
plot(fit)
```

# A little bit math

Our regression equation is $Y=`r b[1]`+`r b[2]`x$, and the model is:

$$ Y = \beta_0 + \beta_1 x + \epsilon$$

# Pandoc extensions {.tabs}

## Definition lists

Programmer
: A programmer is the one who turns coffee into code.

LaTeX
: A simple tool that is nothing but a couple of backslashes.

## Examples

We have some examples.

(@) Think what is `0.3 + 0.4 - 0.7`. Zero. Easy.
(@weird) Now think what is `0.3 - 0.7 + 0.4`. Still zero?

People are often surprised by (@weird).

## Tables

A table here.

Table: Demonstration of simple table syntax.

Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1

You can also generate tables easily using `knitr::kable()` or the **pander** package.

```{r}
knitr::kable(head(iris))
```

## Footnotes

We can also write footnotes[^1].

[^1]: hi, I'm a footnote

Or write some inline footnotes^[as you can see here].

## Citations

We compile the R Markdown file to Markdown through **knitr** [@xie2015] in R [@R-base]. For more about @xie2015, see <http://yihui.name/knitr>.

<div class="tabs is-left is-boxed is-fullwidth">
<ul>
<li class="is-active"><a>Pictures</a></li>
<li><a>Music</a></li>
<li><a>Videos</a></li>
<li><a>Documents</a></li>
</ul>
</div>

# References

+ 3
- 0
tests/manual/custom.css 파일 보기

@@ -0,0 +1,3 @@
body {
font-family: "PT Sans";
}

Loading…
취소
저장