We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Suppose we have the following code:
tpl = [[ % for k, v in pairs(values) do $(k) = $(v) % end ]] text = template.substitute( tpl, { _escape = '%', _parent = _G, values = {a = 1, b = 2, c = 3} } ) print(text)
It appears the escape has no effect:
% for k, v in pairs(tbl) do = % end
If we use something else, like !, we get the expected result:
!
c = 3 a = 1 b = 2
I think we can fix this by passing plain=true to the strfind() calls here, e.g.
plain=true
strfind()
-- Instead of this: local _, e, lua = strfind(chunk,esc_pat1, s) -- Do this: local _, e, lua = strfind(chunk,esc_pat1, s, 1, true)
Environment: OS: Ubuntu 22.04 Lua: 5.4.4 Penlight: 1.13.1
The text was updated successfully, but these errors were encountered:
Can you send a PR for this? I think you fix looks like it will be correct, but we'll want to see some test results, which a PR should show us.
Sorry, something went wrong.
Done: #452
After a bit of tinkering I realized I needed to use string escaping rather than a literal search so that the inline escape would work as well.
Fixed by #452
No branches or pull requests
Suppose we have the following code:
It appears the escape has no effect:
If we use something else, like
!
, we get the expected result:I think we can fix this by passing
plain=true
to thestrfind()
calls here, e.g.Environment:
OS: Ubuntu 22.04
Lua: 5.4.4
Penlight: 1.13.1
The text was updated successfully, but these errors were encountered: