Documentation
¶
Overview ¶
Package templ provides AST parsing for templ files using the official templ parser. It transforms templ template syntax into unified syntax.Node for clone detection.
We focus on structural elements: declarations, HTML elements, flow control, attributes. We skip: text content, attribute values, identifiers.
Index ¶
Constants ¶
View Source
const ( BadNode = iota // ComponentDeclaration represents a component declaration. ComponentDeclaration CSSDeclaration ScriptDeclaration // Element represents an HTML element. Element TagStart TagEnd SelfClosingTag Doctype // StyleElement represents a style element (structural, not content). StyleElement ScriptElement // ComponentIfStatement represents a component if statement. ComponentIfStatement ComponentForStatement ComponentSwitchStatement ComponentSwitchExpressionCase ComponentSwitchDefaultCase // Attribute represents an attribute (structural). Attribute SpreadAttributes ConditionalAttributeIfStatement // Expression represents an expression or block. Expression ComponentBlock ComponentRender ComponentChildrenExpression RawGoBlock // ComponentImport represents an import. ComponentImport // File represents the file root. File )
Node type constants for templ syntax. Meaningful types capture structure without content.
Variables ¶
This section is empty.
Functions ¶
func ParseBytes ¶
ParseBytes parses templ content and returns the syntax tree along with the line count.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.