-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
Template variables' delimiter '%' conflicts with inline CSS #300
Comments
@aharshac you can change the template char from % to another single character here: https://github.com/me-no-dev/ESPAsyncWebServer/blob/master/src/WebResponseImpl.h#L62 What might be good is switch from %VAR% to something like {VAR} instead with unique open/close characters around the variable name. This would likely be less problematic in HTML files (hopefully). |
@atanisoft I've changed the template character to tilde While changing the template format or delimiter character would be excellent, simply avoiding text with spaces between two consecutive |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
This shouldn't be closed because not being able to use the percent character in the CSS templates makes template processing unusable. I've just spent 5 hours debugging the firmware because of that problem. |
Any updates to this issue? There is no readable ASCII character that cannot be normally contained in the html file so changing |
Open and close brackets would be the best approach |
I agree. Open / close tagging along with double delimiters is standard practice for templating engines. Using a single character is ALWAYS going to create an issue for someone. Using a common valid character like % is a really poor choice. It would not be too bad if that single character was user definable, at least the end user could change it on a case-by-case basis, but it's not possible to change it without hacking the core which means that it is not really a valid solution. /DM |
Still an issue, and |
This lib is still not maintained anymore. If you want to change it, you need to tweak the library. |
Hi @me-no-dev
Thank you for an impressive library.
I'm trying to use a template processor on a file from SPIFFS. That file has inline CSS with '%' characters. The template processor considers any text including line breaks and whitespaces as templates. Entire chunks of CSS and other HTML markup are replaced by the default case of the template processor function.
For example, in the snippet below,
;display:flex;justify-content:center;align-items:center;z-index:90;position:absolute;top: 0;"> <div style="width:100
is considered as a template variable.Is it possible to not consider spaces while processing templates? Or rather, have an option to change the template variable delimiter?
The text was updated successfully, but these errors were encountered: