quilt: Make a website from a directory

Description Usage Arguments Value Examples

View source: R/website.R

Description

Makes a website from the contents of a directory. To see the list of file types that can be displayed on the website, execute formats_quilt_can_render(). All files types specified by type in path will be included. This function's options are best specified with configuration files rather than passing values to the function itself. See config_name option documentation.

Usage

1
2
3
4
5
6
7
quilt(path = getwd(), output = NULL, name = "Home", overwrite = FALSE,
  clean = TRUE, output_dir_name = "website", partial_copy = TRUE,
  open = TRUE, theme = "journal", type = formats_quilt_can_render(),
  apply_theme = FALSE, use_file_names = FALSE, use_dir_names = TRUE,
  name_sep = NULL, use_file_suffix = TRUE, use_dir_suffix = TRUE,
  menu_name_parser = function(x) {     x }, placement = character(0),
  cumulative = FALSE, config_name = "quilt_config.yml")

Arguments

path

(character of length 1) The directory in which to look for files to display on the website. This might change in the future; see issue #55

output

(character of length 1) Location to write the output directory. The website will be made in a directory called "website" in this location. If NULL or NA, the the website will be made in a temporary directory.

name

(character of length 1) The name on the link to the homepage of the website. The value of this option can be set by a configuration file at the location specified by path, with name specified by config_name.

overwrite

(logical of length 1) If TRUE, an existing directory with the same name as the output directory will be overwritten. The value of this option can be set by a configuration file at the location specified by path, with name specified by config_name.

clean

(logical of length 1) If TRUE, intermediate files are deleted after use. The value of this option can be set by a configuration file at the location specified by path, with name specified by config_name.

output_dir_name

(character of length 1) The name of the output directory. The value of this option can be set by a configuration file at the location specified by path, with name specified by config_name.

partial_copy

(logical of length 1) If FALSE, The entire target directory of the notes will be copied instead of just the notes and their dependencies. It is possible that more than just the target directory will be copied if there are files in the target directory with dependencies outside it. Enough of the file structure will be copied to included all dependencies. The value of this option can be set by a configuration file at the location specified by path, with name specified by config_name.

open

(logical of length 1) If TRUE, open the newly created website in an internet browser or the RStudio viewer window. The value of this option can be set by a configuration file at the location specified by path, with name specified by config_name.

theme

(character of length 1) The bootstrap theme used in the website. For current options, see http://rmarkdown.rstudio.com/html_document_format.html#appearance-and-style

  • "default"

  • "cerulean"

  • "journal"

  • "flatly"

  • "readable"

  • "spacelab"

  • "united"

  • "cosmo"

The value of this option can be set by a configuration file at the location specified by path, with name specified by config_name.

type

(character) One or more file types to include in the output, specified using file extensions without the leading dot (e.g. type = c("rmd", "html")). The order file types are given in indicates which file is used in the case that files have the same name but different extensions. For example, if type = c("html", "rmd") and there is a note.html and a note.Rmd in the same directory, the note.html will be used and the note.Rmd will be ignored. NOTE: The file type precedence might be specified by a different option in the future. The value of this option can be file-path-specific; see config_name documentation. This might change in the future; see issue #58

apply_theme

(logical of length 1) If TRUE, apply notebook CSS to input file content. This might not always work well depending on content and browser. The value of this option can be file-path-specific; see config_name documentation.

use_file_names

(logical of length 1) If TRUE, The names of files will be be used to determine the hierarchy. The value of this option can be file-path-specific; see config_name documentation.

use_dir_names

(logical of length 1) If TRUE, The names of directories will be used to determine the hierarchy. The value of this option can be file-path-specific; see config_name documentation.

name_sep

(character of length 1) A character to split file/directory names by when using them for parts of the hierarchy. The value of this option can be file-path-specific; see config_name documentation.

use_file_suffix

(logical of length 1) If TRUE, use the last part of a file name when split by the name_sep option. The value of this option can be file-path-specific; see config_name documentation.

use_dir_suffix

(logical of length 1) If TRUE, use the last part of directory names when split by the name_sep option. The value of this option can be file-path-specific; see config_name documentation.

menu_name_parser

(function) Defines a function to apply to each name in the menu hierarchy to chenge it somehow. The function must take a single character input and output a single character. The value of this option can be file-path-specific; see config_name documentation.

placement

(named list of character) Custom content placement rules. Custom website menu heirarchy names can be specified. These (usually; see . documentation below) override hierarchy inferred from file/directory names. The first element in the hierarchy can use the folling special values:

.

Add to the hierarchy inferred from file/directory names instead of overriding it.

..

Add to the hierarchy inferred from file/directory names instead of overriding it, but replace the last file/directory name value.

""

Do not include in website.

The value of this option can be file-path-specific; see config_name documentation.

cumulative

(logical of length 1) If TRUE, all of the intermendiate hierarchy levels will be returned. The value of this option can be file-path-specific; see config_name documentation.

config_name

(character of length 1) The name of configuration files to use. They can be anywhere in directories under path. Configuration files are in YAML format and specify the values of options for this function. Options that are file-path-specific (e.g. type) can take the form of named lists, where names are file paths relative to the location of the configuration file (possibly with * or ** wildcards) and values are the option values relevant to the paths specified in the names. File-path-specific options can be specified by configuraion files anywhere in the target directory, not just the root specified by path. Only some of this function's options are file-path-specific; those that are not (e.g. output) can be specified by values in a configuration file in path. This is the only option that cannot be specified by a configuration file. To ignore website configuartion files, set this option to NA or NULL.

Value

(character of length 1) The file path to the created website's home page (index.html)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 

# Make website out of the current working directory
quilt()

# Create a template directory in the current
# working directory and make a website from it
make_quiltr_template(getwd(), "default")
quilt("default")

## End(Not run)

grunwaldlab/quiltr documentation built on May 17, 2019, 8:40 a.m.