template

package
v0.0.0-...-c50f1b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 4 Imported by: 10

Documentation

Overview

Package template provides convenient access to groups of parsed Soy files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry struct {
	SoyFiles  []*ast.SoyFileNode
	Templates []Template
	// contains filtered or unexported fields
}

Registry provides convenient access to a collection of parsed Soy templates.

func (*Registry) Add

func (r *Registry) Add(soyfile *ast.SoyFileNode) error

Add the given Soy file node (and all contained templates) to this registry.

func (*Registry) ColNumber

func (r *Registry) ColNumber(templateName string, node ast.Node) int

ColNumber computes the column number in the relevant line of input source for the given node within the given template.

func (*Registry) Filename

func (r *Registry) Filename(templateName string) string

Filename identifies the filename containing the specified template

func (*Registry) LineNumber

func (r *Registry) LineNumber(templateName string, node ast.Node) int

LineNumber computes the line number in the input source for the given node within the given template.

func (*Registry) Template

func (r *Registry) Template(name string) (Template, bool)

Template allows lookup by (fully-qualified) template name. The resulting template is returned and a boolean indicating if it was found.

type Template

type Template struct {
	Doc       *ast.SoyDocNode    // this template's SoyDoc, w/ header params added to Doc.Params
	Node      *ast.TemplateNode  // this template's node
	Namespace *ast.NamespaceNode // this template's namespace
}

Template is a Soy template's parse tree, including the relevant context (preceding soydoc and namespace).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL