nimja
nimja copied to clipboard
typed and compiled template engine inspired by jinja2, twig and onionhammer/nim-templates for Nim.
Is it possible to compile these templates at runtime? with a function or something?
the string escaping rules seems to be broken, test these and report errors here.
``` {% let cleaned = path.replace("public", "").replace("\\", "/") %} C:\Users\david\projects\nimja\src\nimja\parser.nim(343, 11) Error: Cannot parse eval body: let cleaned = path.replace("public", "").replace("\", "/") ```
Const variables can be optimized if they're touching a string block, saving an add call
`apply` should behave like a proc call with a block of code ``` {% filter upper %} This text becomes uppercase {% endfilter %} ```
The current file watcher implementation is quite basic and needs polling. Use a real file watcher if available.
https://forum.nim-lang.org/t/8386 and https://github.com/nim-lang/Nim/issues/18780
when curdir is: `C:\Users\david\projects\nimja` then this is valid: ``` {% importnwt ../../tests/templates/blockMasterWithContent.html %} {% extends ./tests/templates/blockMasterWithContent.html %}{% block title %}one{%endblock%}{%block mybody%}two{%endblock%} ``` tested from dynamicAgain branch.
when the error is in a template string, an extra "filename" argument could be passed to the `compileTemplateStr()` to know which template string has the error