emerald icon indicating copy to clipboard operation
emerald copied to clipboard

Usage in Jester?

Open Xe opened this issue 8 years ago • 5 comments

I would like to use Emerald from Jester but I can't seem to figure out how. How would I use this in Jester?

Xe avatar Feb 03 '16 18:02 Xe

Basic example:

import jester, asyncdispatch, emerald

proc index(content: string) {.html_templ.} =
  html(lang = "en"):
    head:
      title: "Index"
    body:
      put content

routes:
  get "/":
    var
      s = newStringStream()
      templ = newIndex()
    templ.content = "Hello, world!"
    templ.render(s)
    resp s.data

runForever()

This may be useful to add to the documentation. Keeping the issue open to remind me of that.

flyx avatar Feb 03 '16 18:02 flyx

When trying this example I get the following error:

lib/pure/collections/sets.nim(282, 43) Error: cannot generate VM code for type(s.data[i].key)

nim -v

Nim Compiler Version 0.14.3 (2016-06-25) [MacOSX: amd64]

ruivieira avatar Jun 25 '16 12:06 ruivieira

Works for me with Nim 0.14.2 (current release), but is broken in devel. Seems to be a Nim bug, I will report it there.

flyx avatar Jun 26 '16 09:06 flyx

Created Nim issue: https://github.com/nim-lang/Nim/issues/4412

flyx avatar Jun 26 '16 10:06 flyx

No problems so far with

nim --version
Nim Compiler Version 0.15.1 (2016-10-15) [Linux: amd64]
git hash: 2d2b1a9d481bffaecac35e1e52929cea66f69e0e

Works with Jester just fine.

goldenreign avatar Oct 18 '16 13:10 goldenreign