diff --git a/vlib/v/parser/tmpl.v b/vlib/v/parser/tmpl.v index fe70bef9af..910fcb8748 100644 --- a/vlib/v/parser/tmpl.v +++ b/vlib/v/parser/tmpl.v @@ -256,30 +256,27 @@ fn vweb_tmpl_${fn_name}() string { match state { .html { - if line.starts_with('span.') && line.ends_with('{') { + line_t := line.trim_space() + if line_t.starts_with('span.') && line.ends_with('{') { // `span.header {` => `` class := line.find_between('span.', '{').trim_space() source.writeln('') in_span = true continue - } - if line.trim_space().starts_with('.') && line.ends_with('{') { + } else if line_t.starts_with('.') && line.ends_with('{') { // `.header {` => `
` class := line.find_between('.', '{').trim_space() trimmed := line.trim_space() source.write_string(strings.repeat(`\t`, line.len - trimmed.len)) // add the necessary indent to keep
code clean source.writeln('
') continue - } - if line.starts_with('#') && line.ends_with('{') { + } else if line_t.starts_with('#') && line.ends_with('{') { // `#header {` => `