apptemplate

package
v0.0.0-...-e5b6c7a Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

The apptemplate package implements template parsing and code generation.

Index

Constants

View Source
const (
	Static uint = iota
	Code
)

Variables

View Source
var MergeStaticText = true // Concatenate consecutive static sections?
View Source
var Verbose = false

Functions

func Process

func Process(siteRoot, templatePath string, writer *bufio.Writer) error

Process is the top-level template parsing function. It calls parse, then glues the sections together and injects an import statement as needed. The final result is printed to a buffered writer.

Types

type Entry

type Entry struct {
	GivenPath, HardPath string      // GivenPath was passed to buildapp or insert.
	FileInfo            os.FileInfo // HardPath is an absolute file-system path.
	InsertionLine       int         // InsertionLine is a line number in the parent.
}

Entry contains path and file information about a template.

func (Entry) String

func (entry Entry) String() string

String implements the fmt.Stringer interface for Entry.

type Pattern

type Pattern struct {
	Text        []rune
	Length, Pos int
}

Pattern helps us keep track of progress in matching a string.

func NewPattern

func NewPattern(s string) Pattern

NewPattern initializes a Pattern for a given string.

func (*Pattern) Next

func (pattern *Pattern) Next(ch rune) bool

Next returns true when Pos advances past the last character of Text.

type Section

type Section struct {
	Kind uint
	Text string
}

Section contains the text of a code section or static section.

Jump to

Keyboard shortcuts

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