vweb: fix @include (#8535)
parent
abde1cd73d
commit
a0cbe48977
|
@ -73,21 +73,18 @@ _ = footer
|
||||||
} else if line == '</script>' {
|
} else if line == '</script>' {
|
||||||
state = .html
|
state = .html
|
||||||
}
|
}
|
||||||
if line.contains('@include ') && false {
|
if line.contains('@include ') {
|
||||||
// TODO
|
lines.delete(i)
|
||||||
pos := line.index('@include ') or { continue }
|
file_name := line.split("'")[1]
|
||||||
file_name := line[pos + 9..]
|
|
||||||
file_path := os.join_path('templates', '${file_name}.html')
|
file_path := os.join_path('templates', '${file_name}.html')
|
||||||
mut file_content := os.read_file(file_path) or {
|
file_content := os.read_file(file_path) or {
|
||||||
panic('reading file $file_name failed')
|
panic('Vweb: Reading file $file_name failed.')
|
||||||
}
|
}
|
||||||
file_content = file_content.replace("'", '"')
|
file_splitted := file_content.split_into_lines().reverse()
|
||||||
lines2 := file_content.split_into_lines()
|
for f in file_splitted {
|
||||||
for l in lines2 {
|
lines.insert(i, f)
|
||||||
lines.insert(i + 1, l)
|
|
||||||
}
|
}
|
||||||
continue
|
i--
|
||||||
// s.writeln(file_content)
|
|
||||||
} else if line.contains('@js ') {
|
} else if line.contains('@js ') {
|
||||||
pos := line.index('@js') or { continue }
|
pos := line.index('@js') or { continue }
|
||||||
s.write('<script src="')
|
s.write('<script src="')
|
||||||
|
|
Loading…
Reference in New Issue