File structure

A .ghtmx file is a Go file that may additionally contain templ, fragment, event, css, and script declarations. Ordinary Go โ€” the package clause, imports, functions, types, variables โ€” passes through to the generated file verbatim.

package main

import "strings"

var greeting = "Hello"

templ page(name string) {
	<p>{ greeting + ", " + strings.TrimSpace(name) }</p>
}

AST: TemplateFile holds Package and a list of TemplateFileNodes; Go passthrough is TemplateFileGoExpression.

Verified by: internal/generator/test-import, internal/generator/test-go-comments, internal/parser.