From e0a44f6c28e05a2fb8aa8bba81e2b083734c31e6 Mon Sep 17 00:00:00 2001 From: JJ Allaire Date: Thu, 11 Feb 2016 13:13:43 -0500 Subject: [PATCH] change name of common options file to `_output.yml` --- R/output_format.R | 15 ++++++++++----- README.Rmd | 4 ++-- README.md | 4 ++-- inst/NEWS | 2 ++ man/default_output_format.Rd | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/R/output_format.R b/R/output_format.R index 78452d49c3..60952586f4 100644 --- a/R/output_format.R +++ b/R/output_format.R @@ -292,7 +292,7 @@ rmarkdown_format <- function(extensions = NULL) { #' Determine the default output format for an R Markdown document #' -#' Read the YAML metadata (and any common _output.yaml file) for the +#' Read the YAML metadata (and any common _output.yml file) for the #' document and return the output format that will be generated by #' a call to \code{\link{render}}. #' @@ -349,7 +349,9 @@ output_format_from_yaml_front_matter <- function(input_lines, # default to no options output_format_options <- list() - # parse common _output.yaml if we have it + # parse common _output.yml if we have it + if (file.exiss("_output.yml")) + common_output_format_yaml <- yaml_load_file_utf8("_output.yml") if (file.exists("_output.yaml")) common_output_format_yaml <- yaml_load_file_utf8("_output.yaml") else @@ -362,7 +364,7 @@ output_format_from_yaml_front_matter <- function(input_lines, # alias the output format yaml output_format_yaml <- yaml_front_matter$output - # merge against common _output.yaml + # merge against common _output.yml output_format_yaml <- merge_output_options(common_output_format_yaml, output_format_yaml) @@ -466,8 +468,11 @@ enumerate_output_formats <- function(input, envir, encoding) { # read the ymal front matter yaml_front_matter <- parse_yaml_front_matter(input_lines) - # read any _output.yaml + # read any _output.yml + output_yml <- file.path(dirname(input), "_output.yml") output_yaml <- file.path(dirname(input), "_output.yaml") + if (file.exists(output_yml)) + common_output_format_yaml <- yaml_load_file_utf8(output_yml) if (file.exists(output_yaml)) common_output_format_yaml <- yaml_load_file_utf8(output_yaml) else @@ -480,7 +485,7 @@ enumerate_output_formats <- function(input, envir, encoding) { # alias the output format yaml output_format_yaml <- yaml_front_matter$output - # merge against common _output.yaml + # merge against common _output.yml output_format_yaml <- merge_output_options(common_output_format_yaml, output_format_yaml) } diff --git a/README.Rmd b/README.Rmd index a72761161f..50565b2214 100644 --- a/README.Rmd +++ b/README.Rmd @@ -110,7 +110,7 @@ render("input.Rmd", "all") #### Shared Output Formats -You can also define output formats externally in a file named `_output.yaml` located in the same directory as the R Markdown source file. For example: +You can also define output formats externally in a file named `_output.yml` located in the same directory as the R Markdown source file. For example: ```yaml html_document: @@ -121,7 +121,7 @@ pdf_document: highlight: zenburn ``` -Using an `_output.yaml` file is a good way to share output settings across multiple R Markdown files in the same directory. +Using an `_output.yml` file is a good way to share output settings across multiple R Markdown files in the same directory. #### Output Format Functions diff --git a/README.md b/README.md index 0b168a248e..e6acfcfadd 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ render("input.Rmd", "all") #### Shared Output Formats -You can also define output formats externally in a file named `_output.yaml` located in the same directory as the R Markdown source file. For example: +You can also define output formats externally in a file named `_output.yml` located in the same directory as the R Markdown source file. For example: ``` yaml html_document: @@ -118,7 +118,7 @@ pdf_document: highlight: zenburn ``` -Using an `_output.yaml` file is a good way to share output settings across multiple R Markdown files in the same directory. +Using an `_output.yml` file is a good way to share output settings across multiple R Markdown files in the same directory. #### Output Format Functions diff --git a/inst/NEWS b/inst/NEWS index ddff146607..1c634cf3c0 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -44,6 +44,8 @@ rmarkdown 0.9.2.9001 (unreleased) * Support `url` references in CSS files for `runtime: shiny` +* Change name of common options file to `_output.yml` + rmarkdown 0.9.2 -------------------------------------------------------------------------------- diff --git a/man/default_output_format.Rd b/man/default_output_format.Rd index 64b15a6e27..1f1d4a357a 100644 --- a/man/default_output_format.Rd +++ b/man/default_output_format.Rd @@ -18,7 +18,7 @@ A named list with a \code{name} value containing the format if the option isn't set explicitly in the document. } \description{ -Read the YAML metadata (and any common _output.yaml file) for the +Read the YAML metadata (and any common _output.yml file) for the document and return the output format that will be generated by a call to \code{\link{render}}. }