Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when char1 == '.', dot names are in name1, otherwise they are in name2
Browse files Browse the repository at this point in the history
yihui committed Oct 20, 2023
1 parent cf884e6 commit f83e823
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
@@ -251,8 +251,9 @@ tikz_dict = function(path) {
fix_names = function(x, char1, char2, aliases) {
name1 = grep(char1, names(x), value = TRUE, fixed = TRUE)
name2 = gsub(char1, char2, name1, fixed = TRUE)
name3 = c(names(opts_chunk_attr), names(opts_chunk$get()))
# only convert names that are known to knitr
i = name2 %in% c(names(opts_chunk_attr), names(opts_chunk$get()))
i = (if (char1 == '.') name1 else name2) %in% name3
if (any(i)) {
x[name2[i]] = x[name1[i]] # move values to to new names
x[name1[i]] = NULL # delete old names

0 comments on commit f83e823

Please sign in to comment.