Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to type curly bracket { in the glue content #127

Closed
JiaxiangBU opened this issue Feb 6, 2019 · 4 comments
Closed

How to type curly bracket { in the glue content #127

JiaxiangBU opened this issue Feb 6, 2019 · 4 comments

Comments

@JiaxiangBU
Copy link

library(glue)
glue("@online{Li2019,")
#> Error in glue_data(.x = NULL, ..., .sep = .sep, .envir = .envir, .open = .open, : Expecting '}'

Created on 2019-02-06 by the reprex package (v0.2.1)

@JiaxiangBU
Copy link
Author

Temporally,

library(glue)
library(rebus)
library(tidyverse)
open <- '{'
glue("@online{open}Li2019,") %>% 
    cat
#> @online{Li2019,

Created on 2019-02-06 by the reprex package (v0.2.1)

I don't think it is an effcient way.

@yutannihilation
Copy link
Member

You can change the opening delimiter by .open.

glue::glue("@online{Li2019,", .open = "{{")
#> @online{Li2019,

Created on 2019-02-06 by the reprex package (v0.2.1.9000)

@JiaxiangBU
Copy link
Author

@yutannihilation Hi, thanks for your quick reply. It works for me by customing the open and close delimiters.

add_text <- 123
glue::glue("@online{Li2019,", .open = "{{")
#> @online{Li2019,
glue::glue("@online{Li20190{{add_text}},", .open = "{{")
#> @online{Li20190123},
glue::glue("@online{Li2019-{add_text},", .open = "{{")
#> @online{Li2019-{add_text},

Created on 2019-02-06 by the reprex package (v0.2.1)

@10b14224cc
Copy link

For the closing delimiter use .close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants