1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: unify const names to snake_case

This commit is contained in:
yuyi
2020-05-22 23:36:09 +08:00
committed by GitHub
parent aef751861d
commit dda875a9c8
58 changed files with 543 additions and 540 deletions

View File

@@ -7,8 +7,8 @@ import os
import strings
const (
STR_START = "sb.write(\'"
STR_END = "\' ) "
str_start = "sb.write(\'"
str_end = "\' ) "
)
pub fn compile_template(path string) string {
@@ -33,7 +33,7 @@ header := \' \' // TODO remove
_ = header
//footer := \'footer\'
")
s.writeln(STR_START)
s.writeln(str_start)
mut in_css := true // false
for _line in lines {
line := _line.trim_space()
@@ -44,30 +44,30 @@ _ = header
// in_css = false
}
if line.contains('@if ') {
s.writeln(STR_END)
s.writeln(str_end)
pos := line.index('@if') or {
continue
}
s.writeln('if ' + line[pos + 4..] + '{')
s.writeln(STR_START)
s.writeln(str_start)
}
else if line.contains('@end') {
s.writeln(STR_END)
s.writeln(str_end)
s.writeln('}')
s.writeln(STR_START)
s.writeln(str_start)
}
else if line.contains('@else') {
s.writeln(STR_END)
s.writeln(str_end)
s.writeln(' } else { ')
s.writeln(STR_START)
s.writeln(str_start)
}
else if line.contains('@for') {
s.writeln(STR_END)
s.writeln(str_end)
pos := line.index('@for') or {
continue
}
s.writeln('for ' + line[pos + 4..] + '{')
s.writeln(STR_START)
s.writeln(str_start)
}
else if !in_css && line.contains('.') && line.ends_with('{') {
class := line.find_between('.', '{')
@@ -81,8 +81,7 @@ _ = header
s.writeln(line.replace('@', '\x24').replace("'", '"'))
}
}
s.writeln(STR_END)
s.writeln(str_end)
s.writeln('tmpl_res := sb.str() }')
return s.str()
}