From 2f4a3dfee6dda3982dbcc8ef94e253c9e0e61ec3 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Thu, 20 Jan 2022 10:44:34 -0800 Subject: [PATCH 1/4] Dummy commit to kick GHA --- R/zzz.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/zzz.R b/R/zzz.R index 8b2b371..4cb66e7 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -11,6 +11,7 @@ s3_register("vctrs::vec_cast", "character.glue") s3_register("vctrs::vec_cast", "glue.character") + # comment if (isNamespaceLoaded("knitr")) { knitr::knit_engines$set(glue = eng_glue, glue_sql = eng_glue_sql, gluesql = eng_glue_sql) } else { From ba7768d0726ec78cd39b351cea0fdfb1b9299fdf Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Thu, 20 Jan 2022 21:55:37 -0800 Subject: [PATCH 2/4] Ensure knitr::knit_engines is accessible --- R/zzz.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/zzz.R b/R/zzz.R index 4cb66e7..a7f44e1 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -12,7 +12,8 @@ s3_register("vctrs::vec_cast", "glue.character") # comment - if (isNamespaceLoaded("knitr")) { + if (isNamespaceLoaded("knitr") && + "knit_engines" %in% getNamespaceExports("knitr")) { knitr::knit_engines$set(glue = eng_glue, glue_sql = eng_glue_sql, gluesql = eng_glue_sql) } else { setHook(packageEvent("knitr", "onLoad"), function(...) { From 01fd09db3b5bd48fb1707b960a908f34a240f751 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Thu, 20 Jan 2022 22:24:30 -0800 Subject: [PATCH 3/4] Remove dummy comment --- R/zzz.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/zzz.R b/R/zzz.R index a7f44e1..4175193 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -11,7 +11,6 @@ s3_register("vctrs::vec_cast", "character.glue") s3_register("vctrs::vec_cast", "glue.character") - # comment if (isNamespaceLoaded("knitr") && "knit_engines" %in% getNamespaceExports("knitr")) { knitr::knit_engines$set(glue = eng_glue, glue_sql = eng_glue_sql, gluesql = eng_glue_sql) From 45aa7ae32e9a6d4702b57ef53d4ee3de2066cac7 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 21 Jan 2022 09:57:40 -0800 Subject: [PATCH 4/4] Add NEWS bullet Also retroactively modify earlier bullet that under-describes a change in 1.5.1 --- NEWS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 06009af..568fa2b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # glue (development version) +* glue now registers its custom knitr engines in a way that is more robust to namespace-loading edge cases that can arise during package installation (#254). + # glue 1.6.0 * `glue()`, `glue_data()`, `glue_col()`, and `glue_data_col()` gain a new `.literal` argument, which controls how quotes and the comment character are treated when parsing the expression string (#235). This is mostly useful when using a custom transformer. @@ -10,7 +12,7 @@ * Jennifer Bryan is now the maintainer. -* The existing custom language engines for knitr, `glue` and `glue_sql`, are documented in a new vignette (#71). +* The existing custom language engines for knitr, `glue` and `glue_sql`, are documented in a new vignette (#71). *Detail added after release: glue now sets up registration of these engines in `.onLoad()`.* * `glue_col()` gives special treatment to styling functions from the crayon package, e.g. `glue_col("{blue foo}")` "just works" now, even if crayon is not attached (but is installed) (#241).