template

package
v0.0.0-...-4dafff4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2017 License: MIT Imports: 4 Imported by: 5

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) 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) SourceFile

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

SourceFile gets the source file for templateName

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
	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 (preceeding soydoc and namespace).

Jump to

Keyboard shortcuts

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