From 30ade1d6eaf9c615e6378747d2100f7997199ffb Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 7 Jun 2020 19:06:02 +0200 Subject: [PATCH] tests: test more vweb template features --- examples/vweb/index.html | 11 +++++++++++ examples/vweb/vweb_example.v | 2 ++ vlib/vweb/tmpl/tmpl.v | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/vweb/index.html b/examples/vweb/index.html index 4391eeb248..d69ff78733 100644 --- a/examples/vweb/index.html +++ b/examples/vweb/index.html @@ -2,3 +2,14 @@ Test app

@hello


+@if show + show = true +@end + +@for number in numbers + @number
+@end + + +
+End. diff --git a/examples/vweb/vweb_example.v b/examples/vweb/vweb_example.v index e73de3b7f3..657bdf2f7d 100644 --- a/examples/vweb/vweb_example.v +++ b/examples/vweb/vweb_example.v @@ -27,8 +27,10 @@ pub fn (mut app App) json_endpoint() { pub fn (mut app App) index() { app.cnt++ + show:= true //app.vweb.text('Hello world from vweb') hello := 'Hello world from vweb' + numbers := [1,2,3] $vweb.html() } diff --git a/vlib/vweb/tmpl/tmpl.v b/vlib/vweb/tmpl/tmpl.v index 94afe8c07e..f0e092bdde 100644 --- a/vlib/vweb/tmpl/tmpl.v +++ b/vlib/vweb/tmpl/tmpl.v @@ -43,7 +43,7 @@ pub fn compile_template(content string) string { //footer := \'footer\' ") s.writeln(str_start) - mut in_css := true // false + mut in_css := false// false for _line in lines { line := _line.trim_space() if line == '