Skip to content

Commit

Permalink
no longer need the mark_utf8 hack after yaml 2.1.14 (vubiostat/r-yaml#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Nov 17, 2016
1 parent be51bb7 commit dd85151
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Imports:
highr,
markdown,
stringr (>= 0.6),
yaml (>= 2.1.5),
yaml (>= 2.1.14),
methods,
tools
Suggests:
Expand Down
16 changes: 1 addition & 15 deletions R/params.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ knit_params = function(text, evaluate = TRUE) {
yaml = yaml_front_matter(text)
if (is.null(yaml)) return(list())

yaml = enc2utf8(yaml)
knit_params_yaml(yaml, evaluate = evaluate)
}

Expand All @@ -106,7 +105,7 @@ knit_params_yaml = function(yaml, evaluate = TRUE) {

# if we found paramters then resolve and return them
if (is.list(parsed_yaml) && !is.null(parsed_yaml$params)) {
resolve_params(mark_utf8(parsed_yaml$params), evaluate = evaluate)
resolve_params(parsed_yaml$params, evaluate = evaluate)
} else {
list()
}
Expand All @@ -119,19 +118,6 @@ flatten_params = function(params) {
res
}

# copied from rmarkdown:::mark_utf8
mark_utf8 = function(x) {
if (is.character(x)) {
Encoding(x) = 'UTF-8'
return(x)
}
if (!is.list(x)) return(x)
attrs = attributes(x)
res = lapply(x, mark_utf8)
attributes(res) = attrs
res
}

# Extract the yaml front matter (if any) from the passed lines. The front
# matter is returned as a single-element character vector (with newlines
# delimited by \n) suitable for passing to yaml::load. This code is based on
Expand Down

0 comments on commit dd85151

Please sign in to comment.