glue has a two new articles:
If the last argument ofglue() is empty, it isdropped (#320). This makes it easy to structureglue()calls with one argument per line, and to anticipate addingarguments:
glue("here's some text, ","and maybe more text will be added in the future?",)glue_sql("{var*}") once again generatesNULL if var is empty.
This reverts #292. (#318).
The.envir argument toglue() andglue_data() really must be an environment now, asdocumented. Previously a list-ish object worked in some cases (byaccident, not really by design). When you need to lookup values in alist-ish object, useglue_data(.x =) (#308, #317). Dittoforglue_sql() andglue_data_sql().
If rlang is installed, glue will generate more informative errorsif an interpolated expression either can’t be parsed or fails toevaluate (#229).
+ now works in more situations, and gives errorswhen one side isn’t a character vector. It no longer automaticallyapplies glue interpolation to a non-glue input, if there is one. You’llneed to do that yourself (#286).
glue_collapse(character()) (and henceglue_sql_collapse(character())) now return"",so that they always return a single string (#88).
glue_sql() now collapses an empty vector to"" not"NULL" (#272).
glue_sql() now usesDBI::dbQuoteLiteral() for all object types. This shouldincrease fidelity of escaping for different object types(#279).
The “Speed of glue” vignette has been converted to an article,which allows several package to be removed fromSuggests(and re-located toConfig/Needs/website). The code got alight refresh, including a switch from microbenchmark to bench and moremodern use of ggplot2.
Add$(C_VISIBILITY) to compiler flags to hideinternal symbols from the dll (#284
glue(),glue_data(),glue_col(), andglue_data_col() gain a new.literal argument, which controls how quotes and thecomment character are treated when parsing the expression string (#235).This is mostly useful when using a custom transformer.
Trailing whitespace-only lines don’t interfere with indentation(#247).
Jennifer Bryan is now the maintainer.
The existing custom language engines for knitr,glueandglue_sql, are documented in a new vignette (#71).Detail added after release: glue now sets up registration of theseengines in.onLoad().
glue_col() gives special treatment to stylingfunctions from the crayon package,e.g. glue_col("{blue foo}") “just works” now, even ifcrayon is not attached (but is installed) (#241).
Unterminated backticks trigger the same error as unterminatedsingle or double quotes (#237).
glue_sql() collapses zero-lengthDBI::SQL object intoDBI::SQL("NULL") (#244@shrektan).
collapse() has been removed(#213)Newglue_sql_collapse() function to collapse inputsand return aDBI::SQL() object (#103).
glue() gains a new.comment argument,to control the comment character (#193).
glue() gains a new.null argument, tocontrol the value to replaceNULL values with (#217,
sql_quote_transformer() is now allows whitespace afterthe trailing* (#218).compare_proxy.glue() method defined so glue objects canbe compared to strings in testthat 3e without errors (#212)print.glue() no longer prints an empty newline for 0length inputs (#214)glue_safe() gives a slightly nicer error messageglue_sql() now collapsesDBI::SQL()elements correctly (#192compare() method gains a...argument, for compatibility with testthat 3.0.0glue_sql() now replaces missing values correctly whencollapsing values (#185).glue_sql() now always preserves the type of the columneven in the presence of missing values (#130).envir = NULL is now supported and is equivalent topassing.envir = emptyenv() (#140)
Newglue_safe() andglue_data_safe()functions, safer versions ofglue() that do not executecode, only look up values (usingget()). These alternativesare useful for things like shiny applications where you do not havecontrol of the input for your glue expressions. (#140)
Fixed memory access issue and memory leaks found byvalgrind.
glue now implements vctrs methods. This ensures that vectors ofglue strings are compatible with tidyverse packages like tidyr(r-lib/tidyselect#170, tidyverse/tidyr#773,
Fix a LTO type mismatch warning (#146)
glue_sql() now quotes lists of values appropriate totheir type, rather than coercing all values to characters(#153)
glue_data() now implicitly coerces.xto a list.
glue() gains the.trim argument, likeglue_data().
single_quote()double_quote() andbacktick() all returnNA forNAinputs (#135).
Improvetrim()’s handling of lines containing onlyindentation (#162, #163,
glue() now has a+ method to combinestrings.glue_sql() now collapses zero-length vector intoDBI::SQL("NULL") (#134glue_sql() now supports unquoting lists of Idobjects.glue_sql() now quotes characters with NAs appropriately(#115).glue_sql() now quotes Dates appropriately (#98).Theevaluate() function has been removed. Changeselsewhere in glue made the implementation trivial so it was removed forthe sake of clarity. Previous uses can be replaced byeval(parse(text = text), envir).
collapse() has been renamed toglue_collapse() to avoid namespace collisions withdplyr::collapse().
compare.glue() was added, to make it easier to useglue objects intestthat::expect_equal()statements.
glue_col() andglue_data_col()functions added to display strings with color.
Glue now throws an informative error message when it cannotinterpolate a function into a string (#114,
Glue now evaluates unnamed arguments lazily withdelayedAssign(), so there is no performance cost if anargument is not used. (#83,
Fixed a bug where names in the assigned expression of aninterpolation variable would conflict with the name of the variableitself (#89,
Do not drop theglue class when subsetting(#66).
Fixglue() andcollapse() always returnUTF-8 encoded strings (#81,
The implementation has been tweaked to be slightly faster in mostcases.
glue() now has a.transformer argument,which allows you to use custom logic on how to evaluate the code withinglue blocks. Seevignette("transformers") for more detailsand example transformer functions.
glue() now returnsNA if any of theresults areNA and.na isNULL.OtherwiseNA values are replaced by the value of.na.
trim() to use the trimming logic from glue is nowexported.
glue_sql() andglue_data_sql()functions added to make constructing SQL statements with glue safer andeasier.
glue() is now easier to use when used within helperfunctions such aslapply.
Fix when last expression inglue() is NULL.
Fix for PROTECT errors when resizing output strings.
glue() always returns ‘UTF-8’ strings, convertinginputs if in other encodings if needed.
to() andto_data() have beenremoved.
glue() andglue_data() can now takealternative delimiters to{ and}. This isuseful if you are writing to a format that uses a lot of braces, such asLaTeX. (#23)
collapse() now returns 0 length output if given 0length input (#28).
Fixglue() to admit. as an embeddedexpression in a string (#15,
Added aNEWS.md file to track changes to thepackage.