emerald
emerald copied to clipboard
HTML5 templating engine for Nimrod
Enables passing template parameters to mixins: ```nim import emerald proc mySection(title: string) {.html_mixin.} = section: h1: title proc templ(numItems: int) {.html_templ.} = append content: html(lang="en"): body: call_mixin mySection($numItems) ```
```nim import emerald proc mySection() {.html_mixin.} = section: h1: title put mixin_content() proc parent(title: string) {.html_templ.} = block content: h1: title proc templ(numItems: int) {.html_templ: parent.} = append content: call_mixin...
Fixes #21 Macro debugging is soooooo hard :hourglass_flowing_sand:
```nim import emerald proc mySection(title: string) {.html_mixin.} = section: h1: title put mixin_content() proc parent() {.html_templ.}= block content: h1: "Content:" proc templ(numItems: int) {.html_templ: parent.} = append content: html(lang="en"): body:...
The [ARIA attributes](https://www.w3.org/TR/html-aria/) are meant to increase website accessibility, which are using dash inside attribute name, so we need special treatment (like data-*). They're often used in [Bootstrap](https://getbootstrap.com) templates.
It's a regression in compiler that started between version 0.19 and 0.20. This code compiled in Nim 0.20 crashes compiler: ```nim import emerald proc parent() {.html_templ.} = block content: discard...
I've tried this on 0.16.0 and the development branch of Nim. Here's the code: ```Nim import emerald, streams proc mixin_with_params(content: string) {.html_mixin.} = p: content proc genSummaryPage(thingy: string) {.html_templ.} =...
I would like to use Emerald from [Jester](https://github.com/dom96/jester) but I can't seem to figure out how. How would I use this in Jester?
``` nim import emerald, json proc homeView(test: JsonNode) {.html_templ.} = html(lang = "en"): body: p: test["str"].str # This works p: test["int"].num # This doesnt p: $(test["int"].num) # This doesnt as...
``` var a = "" b = 0 strong(a) # fails strong($b) # also fails ```