Skip to content

Commit a712d64

Browse files
committed
Manage internal env through setter / getter / cleaner
1 parent e34982a commit a712d64

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/resources/rmd/execute.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ execute <- function(input, format, tempDir, libDir, dependencies, cwd, params, r
145145
# create a hidden environment to store specific objects
146146
# Beware to use non conflicted name as this will be in second position right after globalenv.
147147
.quarto_tools_env <- attach(NULL, name = "tools:quarto")
148+
.quarto_tools_env$.assignToQuartoToolsEnv <- function(name, value) {
149+
assign(name, value, envir = .quarto_tools_env)
150+
}
151+
.quarto_tools_env$.getFromQuartoToolsEnv <- function(name) {
152+
get0(name, envir = .quarto_tools_env)
153+
}
154+
.quarto_tools_env$.rmFromQuartoToolsEnv <- function(name) {
155+
if (exists(name, envir = .quarto_tools_env)) {
156+
rm(name, envir = .quarto_tools_env)
157+
}
158+
}
148159

149160
# we need ojs only if markdown has ojs code cells
150161
# inspect code cells for spaces after line breaks

0 commit comments

Comments
 (0)