mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: fix duplicate fn error with multiple templates
This commit is contained in:
@@ -12,14 +12,14 @@ const (
|
||||
)
|
||||
|
||||
// compile_file compiles the content of a file by the given path as a template
|
||||
pub fn compile_file(path string) string {
|
||||
pub fn compile_file(path, fn_name string) string {
|
||||
mut html := os.read_file(path) or {
|
||||
panic('html failed')
|
||||
}
|
||||
return compile_template(html)
|
||||
return compile_template(html, fn_name)
|
||||
}
|
||||
|
||||
pub fn compile_template(content string) string {
|
||||
pub fn compile_template(content, fn_name string) string {
|
||||
// lines := os.read_lines(path)
|
||||
mut html := content
|
||||
mut header := ''
|
||||
@@ -36,7 +36,7 @@ pub fn compile_template(content string) string {
|
||||
s.writeln("
|
||||
import strings
|
||||
// === vweb html template ===
|
||||
fn vweb_tmpl() {
|
||||
fn vweb_tmpl_${fn_name}() {
|
||||
mut sb := strings.new_builder(${lines.len * 30})
|
||||
header := \' \' // TODO remove
|
||||
_ = header
|
||||
|
||||
Reference in New Issue
Block a user