v icon indicating copy to clipboard operation
v copied to clipboard

Template: Replace `@` intelligently

Open elevin72 opened this issue 2 years ago • 3 comments

Fixes #14104.

Added a function which receives a line of template code and replaces all @ symbols based on if it conforms to -@ident [email protected] -@{code}

Added tests in v_parser_test.v

New to open source so please let me know how to improve this.

elevin72 avatar May 08 '22 11:05 elevin72

@spytheman Tests are not passing since there are workarounds in vlib/v/tests/inout/tmpl_parse_html.vv for @ replacements that are no longer necessary. @ was written as @@ when you wanted the literal symbol. Shall I change it?

elevin72 avatar May 16 '22 13:05 elevin72

@spytheman Tests are not passing since there are workarounds in vlib/v/tests/inout/tmpl_parse_html.vv for @ replacements that are no longer necessary. @ was written as @@ when you wanted the literal symbol. Shall I change it?

@medvednikov what do you think?

(I do not know, and can not decide, since V_TEMPLATE support was removed in b42c824)

spytheman avatar May 16 '22 13:05 spytheman

Note that I did put tmpl_parse_html.vv in an explicit skip list in vlib/v/tests/inout/compiler_test.v in c70e18e, so another option may be to just rebase the code, instead of fixing tmpl_parse_html.vv 🤔 .

spytheman avatar May 16 '22 13:05 spytheman