Skip to content

Commit f8bb7c0

Browse files
committed
chore: add set delims demo
1 parent 19ce4e0 commit f8bb7c0

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

demo/classfile_delimiter/blog_yap.gox

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
setDelims "${","}$"
2+
get "/p/:id", ctx => {
3+
ctx.yap "article", {
4+
"id": ctx.param("id"),
5+
}
6+
}
7+
8+
run ":8080"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package main
2+
3+
import "github.com/goplus/yap"
4+
5+
const _ = true
6+
7+
type blog struct {
8+
yap.App
9+
}
10+
//line demo/classfile_delimiter/blog_yap.gox:1
11+
func (this *blog) MainEntry() {
12+
//line demo/classfile_delimiter/blog_yap.gox:1:1
13+
this.SetDelims("${", "}$")
14+
//line demo/classfile_delimiter/blog_yap.gox:2:1
15+
this.Get("/p/:id", func(ctx *yap.Context) {
16+
//line demo/classfile_delimiter/blog_yap.gox:3:1
17+
ctx.Yap__1("article", map[string]string{"id": ctx.Param("id")})
18+
})
19+
//line demo/classfile_delimiter/blog_yap.gox:8:1
20+
this.Run(":8080")
21+
}
22+
func main() {
23+
//line demo/classfile_delimiter/blog_yap.gox:8:1
24+
yap.Gopt_App_Main(new(blog))
25+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
article: ${ .id }$
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)