wahani / templates

Tools for Template Programming in R
Other
2 stars 1 forks source link

Escape of \\ in arguments #7

Closed wahani closed 5 years ago

wahani commented 5 years ago

We would expect:

as.character(tmplUpdate(tmpl("{{ test }} \\\\"), test = "\\\\"))
[1] "\\\\ \\\\"
> as.character(tmplUpdate(tmpl("{{ test }} \\\\"), test = "\n"))
[1] "\n \\\\"
> as.character(tmplUpdate(tmpl("{{ test }} \\\\"), test = "\\n"))
[1] "\\n \\\\"

But we get

as.character(tmplUpdate(tmpl("{{ test }} \\\\"), test = "\\\\"))
[1] "\\ \\\\"
> as.character(tmplUpdate(tmpl("{{ test }} \\\\"), test = "\n"))
[1] " \\\\"
> as.character(tmplUpdate(tmpl("{{ test }} \\\\"), test = "\\n"))
[1] "n \\\\"