vweb: fix html example

pull/2056/head
Alexander Medvednikov 2019-09-20 03:01:52 +03:00
parent d51622d721
commit 79abc0c16f
3 changed files with 20 additions and 5 deletions

View File

@ -71,7 +71,7 @@ mut:
out_name string // "program.exe" out_name string // "program.exe"
vroot string vroot string
mod string // module being built with -lib mod string // module being built with -lib
//parsers []Parser parsers []Parser
} }
struct Preferences { struct Preferences {
@ -206,6 +206,16 @@ fn main() {
} }
} }
fn (v mut V) add_parser(parser Parser) {
for p in v.parsers {
if p.file_path == parser.file_path {
return
}
}
v.parsers << parser
}
fn (v mut V) compile() { fn (v mut V) compile() {
// Emily: Stop people on linux from being able to build with msvc // Emily: Stop people on linux from being able to build with msvc
if os.user_os() != 'windows' && v.os == .msvc { if os.user_os() != 'windows' && v.os == .msvc {

View File

@ -1 +1,5 @@
test <b>app</b> test <b>app</b>
<br>
<hr>

View File

@ -9,6 +9,7 @@ const (
struct App { struct App {
pub mut: pub mut:
vweb vweb.Context // TODO embed vweb vweb.Context // TODO embed
cnt int
} }
fn main() { fn main() {
@ -23,11 +24,11 @@ pub fn (app mut App) json_endpoint() {
app.vweb.json('{"a": 3}') app.vweb.json('{"a": 3}')
} }
/*
pub fn (app mut App) index() { pub fn (app mut App) index() {
$vweb.html() app.cnt ++
$vweb.html()
} }
*/
pub fn (app mut App) text() { pub fn (app mut App) text() {
app.vweb.text('hello world') app.vweb.text('hello world')
@ -38,4 +39,4 @@ pub fn (app mut App) cookie() {
app.vweb.set_cookie('cookie', 'test') app.vweb.set_cookie('cookie', 'test')
app.vweb.text(app.vweb.headers) app.vweb.text(app.vweb.headers)
app.vweb.text('Text: hello world') app.vweb.text('Text: hello world')
} }