Fix Jinja2 escaping of zsh PROMPT in cloud-init template#41
Conversation
The zsh PROMPT string contains `%` sequences that Jinja2 interprets
as template syntax. Wrap in {% raw %}...{% endraw %} to preserve
the literal prompt definition.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DarkaMaul
left a comment
There was a problem hiding this comment.
Good catch here - but just a question:
would it be better to do the opposite. Wrap everything in {raw} block and leave outside raw blocks only the part that need interpolation
Because jinja needs escaping also for {{ and {#
|
Wouldn't that be messier? There are many lines where the |
I haven't really considered how messy it would be - I was just scared that the next time we're going to modify this file, we may use an escaped syntax. But you're right, that's a low probability risk. |
The zsh PROMPT string contains
%sequences that Jinja2 interprets as template syntax. Wrap in {% raw %}...{% endraw %} to preserve the literal prompt definition.