From f83e8231af5ecd63f0f41ec7fe461710c040e317 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Fri, 20 Oct 2023 13:46:57 -0500 Subject: [PATCH] when char1 == '.', dot names are in name1, otherwise they are in name2 --- R/utils.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 5a587d0fb9..d32f63b4d1 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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