From e398947f130821f20fa805b4c8e74453602bdd59 Mon Sep 17 00:00:00 2001
From: Alexander Arvidsson
<2972103+AlexanderArvidsson@users.noreply.github.com>
Date: Thu, 12 Sep 2024 20:05:29 +0200
Subject: [PATCH 1/7] fix(fmt): Preserve multiple newlines between elements
(#374)
---
parser/v2/elementparser.go | 2 +-
parser/v2/elementparser_test.go | 37 +++++++++++++++++++
.../element_double_newline_is_preserved.txt | 28 ++++++++++++++
parser/v2/gocodeparser.go | 2 +-
parser/v2/stringexpressionparser.go | 2 +-
parser/v2/textparser.go | 2 +-
parser/v2/textparser_test.go | 16 +++++++-
parser/v2/types.go | 24 +++++++++---
8 files changed, 101 insertions(+), 12 deletions(-)
create mode 100644 parser/v2/formattestdata/element_double_newline_is_preserved.txt
diff --git a/parser/v2/elementparser.go b/parser/v2/elementparser.go
index 3c3e73d3f..60290e4c4 100644
--- a/parser/v2/elementparser.go
+++ b/parser/v2/elementparser.go
@@ -471,7 +471,7 @@ func addTrailingSpaceAndValidate(start parse.Position, e Element, pi *parse.Inpu
if err != nil {
return e, false, err
}
- e.TrailingSpace, err = NewTrailingSpace(ws)
+ e.TrailingSpace, err = NewTrailingSpace(ws, true)
if err != nil {
return e, false, err
}
diff --git a/parser/v2/elementparser_test.go b/parser/v2/elementparser_test.go
index 0c7796dc7..065f89ab2 100644
--- a/parser/v2/elementparser_test.go
+++ b/parser/v2/elementparser_test.go
@@ -1538,6 +1538,43 @@ func TestElementParser(t *testing.T) {
},
},
},
+ {
+ name: "element: with multiple newlines, should collapse to two",
+ input: `
for which any
diff --git a/parser/v2/formattestdata/element_double_newline_is_preserved.txt b/parser/v2/formattestdata/element_double_newline_is_preserved.txt
new file mode 100644
index 000000000..383dfc262
--- /dev/null
+++ b/parser/v2/formattestdata/element_double_newline_is_preserved.txt
@@ -0,0 +1,28 @@
+-- in --
+package main
+
+templ x() {
+
+ Hello
+
+ World
+
+
+
+
+ Foo Bar
+
+}
+-- out --
+package main
+
+templ x() {
+
+
+ Hello
+ World
+
+
+ Foo Bar
+
+}
diff --git a/parser/v2/gocodeparser.go b/parser/v2/gocodeparser.go
index 027bcc45d..1c0b5c91b 100644
--- a/parser/v2/gocodeparser.go
+++ b/parser/v2/gocodeparser.go
@@ -36,7 +36,7 @@ var goCode = parse.Func(func(pi *parse.Input) (n Node, ok bool, err error) {
if err != nil {
return r, false, err
}
- r.TrailingSpace, err = NewTrailingSpace(ws)
+ r.TrailingSpace, err = NewTrailingSpace(ws, true)
if err != nil {
return r, false, err
}
diff --git a/parser/v2/stringexpressionparser.go b/parser/v2/stringexpressionparser.go
index 0a4457163..e48aca650 100644
--- a/parser/v2/stringexpressionparser.go
+++ b/parser/v2/stringexpressionparser.go
@@ -30,7 +30,7 @@ var stringExpression = parse.Func(func(pi *parse.Input) (n Node, ok bool, err er
if err != nil {
return r, false, err
}
- r.TrailingSpace, err = NewTrailingSpace(ws)
+ r.TrailingSpace, err = NewTrailingSpace(ws, false)
if err != nil {
return r, false, err
}
diff --git a/parser/v2/textparser.go b/parser/v2/textparser.go
index d5353a9c4..fef81e805 100644
--- a/parser/v2/textparser.go
+++ b/parser/v2/textparser.go
@@ -35,7 +35,7 @@ var textParser = parse.Func(func(pi *parse.Input) (n Node, ok bool, err error) {
if err != nil {
return t, false, err
}
- t.TrailingSpace, err = NewTrailingSpace(ws)
+ t.TrailingSpace, err = NewTrailingSpace(ws, false)
if err != nil {
return t, false, err
}
diff --git a/parser/v2/textparser_test.go b/parser/v2/textparser_test.go
index 2e4602f33..3118d0f29 100644
--- a/parser/v2/textparser_test.go
+++ b/parser/v2/textparser_test.go
@@ -80,7 +80,7 @@ func TestTextParser(t *testing.T) {
},
},
{
- name: "Multiline text is colected line by line",
+ name: "Multiline text is collected line by line",
input: "Line 1\nLine 2",
expected: Text{
Value: "Line 1",
@@ -92,7 +92,7 @@ func TestTextParser(t *testing.T) {
},
},
{
- name: "Multiline text is colected line by line (Windows)",
+ name: "Multiline text is collected line by line (Windows)",
input: "Line 1\r\nLine 2",
expected: Text{
Value: "Line 1",
@@ -103,6 +103,18 @@ func TestTextParser(t *testing.T) {
TrailingSpace: "\n",
},
},
+ {
+ name: "Multiline text with multiple newlines is collected line by line",
+ input: "Line 1\n\n\n\nLine 2",
+ expected: Text{
+ Value: "Line 1",
+ Range: Range{
+ From: Position{Index: 0, Line: 0, Col: 0},
+ To: Position{Index: 6, Line: 0, Col: 6},
+ },
+ TrailingSpace: "\n",
+ },
+ },
}
for _, tt := range tests {
tt := tt
diff --git a/parser/v2/types.go b/parser/v2/types.go
index 34186c438..de93cd5f7 100644
--- a/parser/v2/types.go
+++ b/parser/v2/types.go
@@ -375,17 +375,27 @@ func (t HTMLTemplate) Write(w io.Writer, indent int) error {
type TrailingSpace string
const (
- SpaceNone TrailingSpace = ""
- SpaceHorizontal TrailingSpace = " "
- SpaceVertical TrailingSpace = "\n"
+ SpaceNone TrailingSpace = ""
+ SpaceHorizontal TrailingSpace = " "
+ SpaceVertical TrailingSpace = "\n"
+ SpaceVerticalDouble TrailingSpace = "\n\n"
)
var ErrNonSpaceCharacter = errors.New("non space character found")
-func NewTrailingSpace(s string) (ts TrailingSpace, err error) {
+func NewTrailingSpace(s string, allowMulti bool) (ts TrailingSpace, err error) {
var hasHorizontalSpace bool
- for _, r := range s {
+
+ runes := []rune(s)
+
+ for i, r := range s {
if r == '\n' {
+ if allowMulti && i < len(runes)-1 {
+ next := runes[i+1]
+ if next == '\n' {
+ return SpaceVerticalDouble, nil
+ }
+ }
return SpaceVertical, nil
}
if unicode.IsSpace(r) {
@@ -621,7 +631,9 @@ func writeNodes(w io.Writer, level int, nodes []Node, indent bool) error {
}
// Put a newline after the last node in indentation mode.
if indent && ((nextNodeIsBlock(nodes, i) || i == len(nodes)-1) || shouldAlwaysBreakAfter(nodes[i])) {
- trailing = SpaceVertical
+ if !strings.Contains(string(trailing), string(SpaceVertical)) {
+ trailing = SpaceVertical
+ }
}
switch trailing {
case SpaceNone:
From 2f6aa042a02d7457bfceb93c24b0a915ca30b94e Mon Sep 17 00:00:00 2001
From: Alexander Arvidsson
<2972103+AlexanderArvidsson@users.noreply.github.com>
Date: Sat, 14 Sep 2024 01:22:33 +0200
Subject: [PATCH 2/7] fix(fmt): Double newline indent & strip newline in minify
---
generator/generator.go | 2 +-
.../element_double_newline_indent_issue.txt | 25 +++++++++++++++++++
...wline_string_literal_termination_issue.txt | 25 +++++++++++++++++++
parser/v2/types.go | 8 +++---
4 files changed, 55 insertions(+), 5 deletions(-)
create mode 100644 parser/v2/formattestdata/element_double_newline_indent_issue.txt
create mode 100644 parser/v2/formattestdata/element_double_newline_string_literal_termination_issue.txt
diff --git a/generator/generator.go b/generator/generator.go
index 943c695b5..6830d943a 100644
--- a/generator/generator.go
+++ b/generator/generator.go
@@ -604,7 +604,7 @@ func (g *generator) writeWhitespaceTrailer(indentLevel int, n parser.TrailingSpa
}
// Normalize whitespace for minified output. In HTML, a single space is equivalent to
// any number of spaces, tabs, or newlines.
- if n == parser.SpaceVertical {
+ if n == parser.SpaceVertical || n == parser.SpaceVerticalDouble {
n = parser.SpaceHorizontal
}
if _, err = g.w.WriteStringLiteral(indentLevel, string(n)); err != nil {
diff --git a/parser/v2/formattestdata/element_double_newline_indent_issue.txt b/parser/v2/formattestdata/element_double_newline_indent_issue.txt
new file mode 100644
index 000000000..4732a5a3b
--- /dev/null
+++ b/parser/v2/formattestdata/element_double_newline_indent_issue.txt
@@ -0,0 +1,25 @@
+-- in --
+package main
+
+templ x() {
+
+
+
+ // This line is indented incorrectly
+
+
+
+}
+
+-- out --
+package main
+
+templ x() {
+
+
+
+ // This line is indented incorrectly
+
+
+
+}
diff --git a/parser/v2/formattestdata/element_double_newline_string_literal_termination_issue.txt b/parser/v2/formattestdata/element_double_newline_string_literal_termination_issue.txt
new file mode 100644
index 000000000..0962cc808
--- /dev/null
+++ b/parser/v2/formattestdata/element_double_newline_string_literal_termination_issue.txt
@@ -0,0 +1,25 @@
+-- in --
+package main
+
+// The below template caused the generated code to not strip newlines, causing error
+templ x() {
+
+}
+-- out --
+package main
+
+// The below template caused the generated code to not strip newlines, causing error
+templ x() {
+
+}
diff --git a/parser/v2/types.go b/parser/v2/types.go
index de93cd5f7..e300d4d1c 100644
--- a/parser/v2/types.go
+++ b/parser/v2/types.go
@@ -630,10 +630,8 @@ func writeNodes(w io.Writer, level int, nodes []Node, indent bool) error {
trailing = wst.Trailing()
}
// Put a newline after the last node in indentation mode.
- if indent && ((nextNodeIsBlock(nodes, i) || i == len(nodes)-1) || shouldAlwaysBreakAfter(nodes[i])) {
- if !strings.Contains(string(trailing), string(SpaceVertical)) {
- trailing = SpaceVertical
- }
+ if indent && trailing != SpaceVerticalDouble && ((nextNodeIsBlock(nodes, i) || i == len(nodes)-1) || shouldAlwaysBreakAfter(nodes[i])) {
+ trailing = SpaceVertical
}
switch trailing {
case SpaceNone:
@@ -642,6 +640,8 @@ func writeNodes(w io.Writer, level int, nodes []Node, indent bool) error {
level = 0
case SpaceVertical:
level = startLevel
+ case SpaceVerticalDouble:
+ level = startLevel
}
if _, err := w.Write([]byte(trailing)); err != nil {
return err
From dc3c684cf14b359044cf195cca00a1636d0e5941 Mon Sep 17 00:00:00 2001
From: Alexander Arvidsson
<2972103+AlexanderArvidsson@users.noreply.github.com>
Date: Sat, 14 Sep 2024 01:53:21 +0200
Subject: [PATCH 3/7] fix(fmt): Preserve newline after templ elements
---
...element_double_newline_after_component.txt | 29 +++++++++++++++++++
parser/v2/templateparser_test.go | 2 +-
parser/v2/templelementparser.go | 26 ++++++++++++++++-
parser/v2/templelementparser_test.go | 6 +++-
parser/v2/types.go | 6 ++++
5 files changed, 66 insertions(+), 3 deletions(-)
create mode 100644 parser/v2/formattestdata/element_double_newline_after_component.txt
diff --git a/parser/v2/formattestdata/element_double_newline_after_component.txt b/parser/v2/formattestdata/element_double_newline_after_component.txt
new file mode 100644
index 000000000..5792f45fd
--- /dev/null
+++ b/parser/v2/formattestdata/element_double_newline_after_component.txt
@@ -0,0 +1,29 @@
+-- in --
+package main
+
+templ x() {
+
+ @Hero()
+
+
+
+ @Hero()
+
+
+
+
+
+}
+-- out --
+package main
+
+templ x() {
+
+ @Hero()
+
+
+ @Hero()
+
+
+
+}
diff --git a/parser/v2/templateparser_test.go b/parser/v2/templateparser_test.go
index 6b0eff2db..6c814951f 100644
--- a/parser/v2/templateparser_test.go
+++ b/parser/v2/templateparser_test.go
@@ -626,8 +626,8 @@ func TestTemplateParser(t *testing.T) {
},
},
},
+ TrailingSpace: SpaceHorizontal,
},
- Whitespace{Value: " "},
Text{
Value: "Home",
Range: Range{
diff --git a/parser/v2/templelementparser.go b/parser/v2/templelementparser.go
index 9a50b5b03..51e884977 100644
--- a/parser/v2/templelementparser.go
+++ b/parser/v2/templelementparser.go
@@ -13,7 +13,11 @@ func (p templElementExpressionParser) Parse(pi *parse.Input) (n Node, ok bool, e
return
}
- var r TemplElementExpression
+ r := TemplElementExpression{
+ // Default behavior is always a trailing space
+ TrailingSpace: SpaceVertical,
+ }
+
// Parse the Go expression.
if r.Expression, err = parseGo("templ element", pi, goexpression.TemplExpression); err != nil {
return r, false, err
@@ -26,6 +30,16 @@ func (p templElementExpressionParser) Parse(pi *parse.Input) (n Node, ok bool, e
return
}
if !hasOpenBrace {
+ // Parse trailing whitespace after expression.
+ ws, _, err := parse.Whitespace.Parse(pi)
+ if err != nil {
+ return r, false, err
+ }
+ r.TrailingSpace, err = NewTrailingSpace(ws, true)
+ if err != nil {
+ return r, false, err
+ }
+
return r, true, nil
}
@@ -46,6 +60,16 @@ func (p templElementExpressionParser) Parse(pi *parse.Input) (n Node, ok bool, e
return
}
+ // Parse trailing whitespace after closing brace.
+ ws, _, err := parse.Whitespace.Parse(pi)
+ if err != nil {
+ return r, false, err
+ }
+ r.TrailingSpace, err = NewTrailingSpace(ws, true)
+ if err != nil {
+ return r, false, err
+ }
+
return r, true, nil
}
diff --git a/parser/v2/templelementparser_test.go b/parser/v2/templelementparser_test.go
index 478620dc3..1ef8ffaf5 100644
--- a/parser/v2/templelementparser_test.go
+++ b/parser/v2/templelementparser_test.go
@@ -32,6 +32,7 @@ func TestTemplElementExpressionParser(t *testing.T) {
},
},
},
+ TrailingSpace: SpaceVertical,
},
},
{
@@ -53,6 +54,7 @@ func TestTemplElementExpressionParser(t *testing.T) {
},
},
},
+ TrailingSpace: SpaceVertical,
},
},
{
@@ -80,6 +82,7 @@ func TestTemplElementExpressionParser(t *testing.T) {
},
},
},
+ TrailingSpace: SpaceVertical,
},
},
{
@@ -190,8 +193,8 @@ func TestTemplElementExpressionParser(t *testing.T) {
To: Position{28, 1, 11},
},
},
+ TrailingSpace: SpaceVertical,
},
- Whitespace{Value: "\n\t\t\t"},
},
},
},
@@ -215,6 +218,7 @@ func TestTemplElementExpressionParser(t *testing.T) {
},
},
},
+ TrailingSpace: SpaceHorizontal,
},
},
{
diff --git a/parser/v2/types.go b/parser/v2/types.go
index e300d4d1c..507d93b36 100644
--- a/parser/v2/types.go
+++ b/parser/v2/types.go
@@ -956,6 +956,12 @@ type TemplElementExpression struct {
Expression Expression
// Children returns the elements in a block element.
Children []Node
+ // TrailingSpace lists what happens after the element.
+ TrailingSpace TrailingSpace
+}
+
+func (t TemplElementExpression) Trailing() TrailingSpace {
+ return t.TrailingSpace
}
func (tee TemplElementExpression) ChildNodes() []Node {
From aa31f9374a99fb9d457411de6b039253e5329cee Mon Sep 17 00:00:00 2001
From: Alexander Arvidsson
<2972103+AlexanderArvidsson@users.noreply.github.com>
Date: Thu, 19 Sep 2024 20:45:50 +0200
Subject: [PATCH 4/7] fix(fmt): Preserve newlines in most parsers (#374)
---
parser/v2/calltemplateparser.go | 5 +
parser/v2/calltemplateparser_test.go | 22 ++++
parser/v2/elementparser.go | 7 +-
parser/v2/forexpressionparser.go | 15 ++-
parser/v2/forexpressionparser_test.go | 2 +
.../calltemplate_newline_is_preserved.txt | 34 ++++++
.../comments_newline_is_preserved.txt | 31 ++++++
.../for_loops_are_placed_on_a_new_line.txt | 3 +-
.../for_loops_newline_is_preserved.txt | 33 ++++++
.../if_statement_newline_is_preserved.txt | 37 +++++++
...if_statements_are_placed_on_a_new_line.txt | 3 +-
.../switch_newline_is_preserved.txt | 43 ++++++++
...ch_statements_are_placed_on_a_new_line.txt | 3 +-
parser/v2/gocodeparser.go | 7 +-
parser/v2/htmlcommentparser.go | 5 +
parser/v2/ifexpressionparser.go | 15 ++-
parser/v2/ifexpressionparser_test.go | 11 +-
parser/v2/stringexpressionparser.go | 7 +-
parser/v2/switchexpressionparser.go | 15 ++-
parser/v2/switchexpressionparser_test.go | 4 +
parser/v2/templateparser_test.go | 10 +-
parser/v2/templelementparser.go | 14 +--
parser/v2/textparser.go | 7 +-
parser/v2/types.go | 101 +++++++++++++++++-
parser/v2/whitespaceparser.go | 16 +++
25 files changed, 397 insertions(+), 53 deletions(-)
create mode 100644 parser/v2/formattestdata/calltemplate_newline_is_preserved.txt
create mode 100644 parser/v2/formattestdata/comments_newline_is_preserved.txt
create mode 100644 parser/v2/formattestdata/for_loops_newline_is_preserved.txt
create mode 100644 parser/v2/formattestdata/if_statement_newline_is_preserved.txt
create mode 100644 parser/v2/formattestdata/switch_newline_is_preserved.txt
diff --git a/parser/v2/calltemplateparser.go b/parser/v2/calltemplateparser.go
index 3e82a2064..70f6a3444 100644
--- a/parser/v2/calltemplateparser.go
+++ b/parser/v2/calltemplateparser.go
@@ -29,5 +29,10 @@ func (p callTemplateExpressionParser) Parse(pi *parse.Input) (n Node, ok bool, e
return
}
+ // Parse trailing whitespace.
+ if _, _, err := addTrailingSpace(&r, pi, true); err != nil {
+ return r, false, err
+ }
+
return r, true, nil
}
diff --git a/parser/v2/calltemplateparser_test.go b/parser/v2/calltemplateparser_test.go
index 765d91500..22319114e 100644
--- a/parser/v2/calltemplateparser_test.go
+++ b/parser/v2/calltemplateparser_test.go
@@ -76,6 +76,28 @@ func TestCallTemplateExpressionParser(t *testing.T) {
},
},
},
+ {
+ name: "call: can parse the initial expression and leave the text",
+ input: `{!Other(p.Test)} Home`,
+ expected: CallTemplateExpression{
+ Expression: Expression{
+ Value: "Other(p.Test)",
+ Range: Range{
+ From: Position{
+ Index: 2,
+ Line: 0,
+ Col: 2,
+ },
+ To: Position{
+ Index: 15,
+ Line: 0,
+ Col: 15,
+ },
+ },
+ },
+ TrailingSpace: SpaceHorizontal,
+ },
+ },
}
for _, tt := range tests {
tt := tt
diff --git a/parser/v2/elementparser.go b/parser/v2/elementparser.go
index 60290e4c4..12d28f3c5 100644
--- a/parser/v2/elementparser.go
+++ b/parser/v2/elementparser.go
@@ -467,12 +467,7 @@ func addTrailingSpaceAndValidate(start parse.Position, e Element, pi *parse.Inpu
return e, false, err
}
// Add trailing space.
- ws, _, err := parse.Whitespace.Parse(pi)
- if err != nil {
- return e, false, err
- }
- e.TrailingSpace, err = NewTrailingSpace(ws, true)
- if err != nil {
+ if _, _, err := addTrailingSpace(&e, pi, true); err != nil {
return e, false, err
}
diff --git a/parser/v2/forexpressionparser.go b/parser/v2/forexpressionparser.go
index 3f8bc2ec1..8978291db 100644
--- a/parser/v2/forexpressionparser.go
+++ b/parser/v2/forexpressionparser.go
@@ -10,7 +10,10 @@ var forExpression parse.Parser[Node] = forExpressionParser{}
type forExpressionParser struct{}
func (forExpressionParser) Parse(pi *parse.Input) (n Node, ok bool, err error) {
- var r ForExpression
+ r := ForExpression{
+ // Default behavior is always a trailing space
+ TrailingSpace: SpaceVertical,
+ }
start := pi.Index()
// Strip leading whitespace and look for `for `.
@@ -48,5 +51,15 @@ func (forExpressionParser) Parse(pi *parse.Input) (n Node, ok bool, err error) {
return
}
+ // Parse trailing whitespace.
+ if _, _, err := addTrailingSpace(&r, pi, true); err != nil {
+ return r, false, err
+ }
+
+ // If the trailing space is not vertical, set it to vertical.
+ if r.TrailingSpace != SpaceVertical && r.TrailingSpace != SpaceVerticalDouble {
+ r.TrailingSpace = SpaceVertical
+ }
+
return r, true, nil
}
diff --git a/parser/v2/forexpressionparser_test.go b/parser/v2/forexpressionparser_test.go
index 4a012e7b2..630dc17ad 100644
--- a/parser/v2/forexpressionparser_test.go
+++ b/parser/v2/forexpressionparser_test.go
@@ -64,6 +64,7 @@ func TestForExpressionParser(t *testing.T) {
TrailingSpace: SpaceVertical,
},
},
+ TrailingSpace: SpaceVertical,
},
},
{
@@ -117,6 +118,7 @@ func TestForExpressionParser(t *testing.T) {
TrailingSpace: SpaceVertical,
},
},
+ TrailingSpace: SpaceVertical,
},
},
}
diff --git a/parser/v2/formattestdata/calltemplate_newline_is_preserved.txt b/parser/v2/formattestdata/calltemplate_newline_is_preserved.txt
new file mode 100644
index 000000000..d04232fc4
--- /dev/null
+++ b/parser/v2/formattestdata/calltemplate_newline_is_preserved.txt
@@ -0,0 +1,34 @@
+-- in --
+package main
+
+templ test() {
+
+
+
+ {! Other(p.Test) }
+ {!Other(p.Test)} Home
+
+
Some standard templ
+
+{!Other(p.Test) }
+
+
+
+
+
+}
+-- out --
+package main
+
+templ test() {
+
+
+ @Other(p.Test)
+ @Other(p.Test) Home
+
Some standard templ
+
+ @Other(p.Test)
+
+
+
+}
diff --git a/parser/v2/formattestdata/comments_newline_is_preserved.txt b/parser/v2/formattestdata/comments_newline_is_preserved.txt
new file mode 100644
index 000000000..30f7ca4af
--- /dev/null
+++ b/parser/v2/formattestdata/comments_newline_is_preserved.txt
@@ -0,0 +1,31 @@
+-- in --
+package main
+
+templ test() {
+
+
+ // This is not included in the output.
+
Some standard templ
+
+
+ /* This is not included in the output too. */
+ /*
+ Leave this alone.
+ */
+
+
+}
+-- out --
+package main
+
+templ test() {
+
+
+ // This is not included in the output.
+
Some standard templ
+
+ /* This is not included in the output too. */
+ /*
+ Leave this alone.
+ */
+}
diff --git a/parser/v2/formattestdata/for_loops_are_placed_on_a_new_line.txt b/parser/v2/formattestdata/for_loops_are_placed_on_a_new_line.txt
index 97f7d586f..0ca1de359 100644
--- a/parser/v2/formattestdata/for_loops_are_placed_on_a_new_line.txt
+++ b/parser/v2/formattestdata/for_loops_are_placed_on_a_new_line.txt
@@ -4,7 +4,7 @@ package test
templ input(items []string) {
{ "the" }
{ "other" }
for _, item := range items {
{ item }
-}
+}
After closing bracket
}
-- out --
package test
@@ -16,5 +16,6 @@ templ input(items []string) {
for _, item := range items {