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

ci: fix v test-cleancode

This commit is contained in:
Delyan Angelov
2021-01-25 11:26:20 +02:00
parent 94fd3ff431
commit 728344ff65
49 changed files with 353 additions and 356 deletions

View File

@@ -58,7 +58,7 @@ footer := \' \' // TODO remove
_ = footer
")
s.write(str_start)
s.write(tmpl.str_start)
mut state := State.html
mut in_span := false
// for _line in lines {
@@ -99,23 +99,23 @@ _ = footer
s.write(line[pos + 6..line.len - 1])
s.writeln('" rel="stylesheet" type="text/css">')
} else if line.contains('@if ') {
s.writeln(str_end)
s.writeln(tmpl.str_end)
pos := line.index('@if') or { continue }
s.writeln('if ' + line[pos + 4..] + '{')
s.writeln(str_start)
s.writeln(tmpl.str_start)
} else if line.contains('@end') {
s.writeln(str_end)
s.writeln(tmpl.str_end)
s.writeln('}')
s.writeln(str_start)
s.writeln(tmpl.str_start)
} else if line.contains('@else') {
s.writeln(str_end)
s.writeln(tmpl.str_end)
s.writeln(' } else { ')
s.writeln(str_start)
s.writeln(tmpl.str_start)
} else if line.contains('@for') {
s.writeln(str_end)
s.writeln(tmpl.str_end)
pos := line.index('@for') or { continue }
s.writeln('for ' + line[pos + 4..] + '{')
s.writeln(str_start)
s.writeln(tmpl.str_start)
} else if state == .html && line.contains('span.') && line.ends_with('{') {
// `span.header {` => `<span class='header'>`
class := line.find_between('span.', '{').trim_space()
@@ -142,7 +142,7 @@ _ = footer
s.writeln(line.replace('@', '$').replace("'", '"'))
}
}
s.writeln(str_end)
s.writeln(tmpl.str_end)
s.writeln('_tmpl_res_$fn_name := sb.str() ')
s.writeln('}')
s.writeln('// === end of vweb html template ===')