ESPAsyncWebServer icon indicating copy to clipboard operation
ESPAsyncWebServer copied to clipboard

Cant set Table or Cell width % because of template processing

Open MarksWizard opened this issue 1 year ago • 3 comments

Trying to add the following HTML breaks because it picks up the width % as a template. Is there any way to make it keep the % as text like I would do with <font size=\"4\">? Sadly, passing the whole section as %STYLE% template doesn't fix the issue either.

<style> 
html {font-family: Helvetica; display: inline; margin: auto 0; text-align: center;}
table {width: 100%; text-align: center;} 
td {width: 50%; text-align: center; padding: 0 20px;}
</style>

MarksWizard avatar Jul 20 '24 12:07 MarksWizard

I found a solution in issue #1249 . Adding an extra % fixed the issue in my case.

<style> 
html {font-family: Helvetica; display: inline; margin: auto 0; text-align: center;}
table {width: 100%%; text-align: center;} 
td {width: 50%%; text-align: center; padding: 0 20px;}
</style>

MarksWizard avatar Jul 20 '24 12:07 MarksWizard

I would suggest making the delimiter a char 3 and allowing the value to be passed in as a param to the processor. One character really limits the capability. Much more flexible. if the strings or too flexible are a concern, store them in an enum, or limit them to some set of chars like ! @ # $ % ^ & *.

munkerench avatar Jul 25 '24 16:07 munkerench

I second munkerench suggestion. My problematic html was width: 100%; height: 100%; which was picked up as parameter "; height: 100", it took me a while to realize why the page did not behave as expected. My solution was to use instead width: 100vw; height: 100vh; but specifying the delimiter would solve this type of problem once and for all. If a set of chars is to be used I suggest some rarely used chars like: ~ or | Please consider it.

georgepapas123 avatar Oct 17 '24 11:10 georgepapas123