Promptify icon indicating copy to clipboard operation
Promptify copied to clipboard

Template parser can't handle escape characters or mixed quotes in the template definition

Open escesare opened this issue 2 years ago • 4 comments

Both of these example templates result in the error TemplateSyntaxError: unexpected char '\\' at 5:

ner.jinja:

{{ ' "hello world" ' }}

ner.jinja:

{{ " \"\"\"hello world\"\"\" " }}

And I confirmed it's not an issue with jinja, because passing the same template directly to jinja works fine:

>>> jinja2.Template('{{ \' "hello world" \' }}').render()
' "hello world" '

>>> jinja2.Template('{{ " \\"\\"\\"hello world\\"\\"\\" " }}\n').render()
' """hello world""" '

escesare avatar Feb 15 '23 20:02 escesare

Hi Can i take this issue @monk1337

syedjafer avatar Feb 16 '23 01:02 syedjafer

@syedjafer Sure, Plan is to build a verifier. Please check #8 and #4. Feel free to open a PR. If you want to discuss the details, Please ping me on discord.

monk1337 avatar Feb 16 '23 06:02 monk1337

@syedjafer Are you taking the issue?

monk1337 avatar Feb 20 '23 00:02 monk1337

@monk1337 yes mate. but i can take this only on weekends.

syedjafer avatar Feb 20 '23 13:02 syedjafer