Closed Kewlan closed 1 month ago
A few questions:
<!--{{+ p.preset.name }}-->
. Is there a reason why this needs to be formatted like an HTML comment? Why not just use {{
and }}
?Why use such bulky syntax in the templates? e.g.
<!--{{+ p.preset.name }}-->
. Is there a reason why this needs to be formatted like an HTML comment? Why not just use{{
and}}
?
The reason was so that the auto-formatter could work. But as mentioned, it doesn't work well when it's inside attributes so it can't be used everywhere without manually fixing after. I'm fine with changing back to default.
With askama, I'm no longer seeing syntax highlighting in templates with VSCode, whereas this was working with sailfish. Everything just looks commented out as if it were an HTML comment. Did you find a way to get this to work? e.g. do I just need a new extension?
I don't have any related extensions. How does it look for you? Here's what I saw and see:
sailfish (.stpl) | askama (.html) |
---|---|
This is what it currently looks like for me with Sailfish:
Looks like using the default template syntax will solve the problem:
This is with the "Jinja" extension installed.
As mentioned, with this, rust-analyzer in VS Code won't give fake error anymore.
askama doesn't allow writing any rust code anywhere, so I had to make some changed to how things are called. For example, to calculate the total percentage of enabled tricks of a difficulty I implemented a method to the
SeedHeaderTemplate
struct and called that in the template.I formatted some of the html documents, but once I learned that having comments inside attributes didn't work well, I left most of that alone. This is why I initially changed the start and end syntaxes so it would still work well when formatting. I kind of does still, but for those special cases it can mess things up.
I chose to suppress whitespace by default, and then manually preserve whitespace for expressions.
Since this changes a lot, it would be nice to get help make sure everything still works and looks the same. Maybe this could be added to the dev site? I've looked around a bit and tried making seeds and playing them, and fixed everything I found so far.
There aren't many warning left, but I'm thinking I'll fix those separately since this alone is so big.