added test cases from strange loop event
This commit is contained in:
parent
429d337ef6
commit
9ab1a3c724
6 changed files with 152 additions and 0 deletions
37
tests/showoff/thtml2.nim
Normal file
37
tests/showoff/thtml2.nim
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
discard """
|
||||
output: "<html><head><title>now look at this</title></head><body><ul><li>Nimrod is quite capable</li></ul></body></html>"
|
||||
"""
|
||||
|
||||
import strutils
|
||||
|
||||
template html(name: expr, matter: stmt) {.immediate.} =
|
||||
proc name(): string =
|
||||
result = "<html>"
|
||||
matter
|
||||
result.add("</html>")
|
||||
|
||||
template nestedTag(tag: expr) {.immediate.} =
|
||||
template tag(matter: stmt) {.immediate.} =
|
||||
result.add("<" & astToStr(tag) & ">")
|
||||
matter
|
||||
result.add("</" & astToStr(tag) & ">")
|
||||
|
||||
template simpleTag(tag: expr) {.immediate.} =
|
||||
template tag(matter: expr) {.immediate.} =
|
||||
result.add("<$1>$2</$1>" % [astToStr(tag), matter])
|
||||
|
||||
nestedTag body
|
||||
nestedTag head
|
||||
nestedTag ul
|
||||
simpleTag title
|
||||
simpleTag li
|
||||
|
||||
|
||||
html mainPage:
|
||||
head:
|
||||
title "now look at this"
|
||||
body:
|
||||
ul:
|
||||
li "Nimrod is quite capable"
|
||||
|
||||
echo mainPage()
|
||||
Loading…
Add table
Add a link
Reference in a new issue