mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
orm: fix column == var; limit 1; vweb: @footer
This commit is contained in:
@@ -30,6 +30,7 @@ pub fn compile_template(html_, fn_name string) string {
|
||||
// lines := os.read_lines(path)
|
||||
mut html := html_.trim_space()
|
||||
mut header := ''
|
||||
mut footer := ''
|
||||
if os.exists('templates/header.html') && html.contains('@header') {
|
||||
h := os.read_file('templates/header.html') or {
|
||||
panic('reading file templates/header.html failed')
|
||||
@@ -37,6 +38,13 @@ pub fn compile_template(html_, fn_name string) string {
|
||||
header = h.trim_space().replace("\'", '"')
|
||||
html = header + html
|
||||
}
|
||||
if os.exists('templates/footer.html') && html.contains('@footer') {
|
||||
f := os.read_file('templates/footer.html') or {
|
||||
panic('reading file templates/footer.html failed')
|
||||
}
|
||||
footer = f.trim_space().replace("\'", '"')
|
||||
html += footer
|
||||
}
|
||||
|
||||
mut lines := html.split_into_lines()
|
||||
mut s := strings.new_builder(1000)
|
||||
@@ -48,6 +56,8 @@ fn vweb_tmpl_${fn_name}() {
|
||||
mut sb := strings.new_builder(${lines.len * 30})\n
|
||||
header := \' \' // TODO remove
|
||||
_ = header
|
||||
footer := \' \' // TODO remove
|
||||
_ = footer
|
||||
|
||||
")
|
||||
s.write(str_start)
|
||||
|
||||
Reference in New Issue
Block a user