-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow much more in parentehsis expressions. #27
Conversation
Basically, just handle nesting parenthesis, comments, and strings, and let the rust compiler sort everything else out in the generated code. Attempts to handle #25 .
Also, allocate slightly fewer strings.
Ok, now pretty much anything goes inside a parentheis (or brackets) in an expression. But it is probably a bit too flexible at the moment. I'm happy about the following things being permitted expressions (which I think they are now).
But I'm not so sure about:
... and other complex variants ... |
There was some stuff allowed in outer expression that should only be allowed in parentheis, and therefor there is no need to support them speficially.
No need to allocate all those strings.
82ff9aa has regressed. My templates don't compile any more:
https://gitlab.com/crates.rs/front_end/blob/master/templates/home_categories.rs.html#L6 |
907f592 was fine. |
Fix regression introduced in #27, spotted by @kornelski .
Changes since v0.3.16 includes: * Template syntax: - Allow local ranges (i.e. `2..7`) in loop expressions. - Allow underscore rust names. There is use for unused variables in templates, so allow names starting with underscore. - Issue #24 / PR #28: Allow logic operators in `@if ...` expressions. - Issue #25 / PR #27: Allow much more in parentehsis expressions. * Improved examples: - A new design for the framework examples web page, using svg graphics. - Improve code and inline documentation of iron and nickel examples. - Add a similar example with the Gotham framework. * Recognize `.svg` static files. * Allocate much fewer strings when parsing expressions in templates. * PR #26: use `write_all` rather than the `write!` macro in generated code, contributed by @kornelski * Fix `application/octet-stream` MIME type. Contributed by @kornelski. * Use write_str/write_all when generating output. Contributed by @kornelski.
Basically, just handle nesting parenthesis, comments, and strings, and let the rust compiler sort everything else out in the generated code.
Attempts to implement @kornelski s suggestion from #25 .