Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrArchive = errors.New("archiveErr")
View Source
var ErrMimetype = errors.New("mimetypeErr")
View Source
var ErrOverride = errors.New("overrideErr")
View Source
var ErrUnknownType = errors.New("unknownTypeErr")
TODO: Better error description and use it in Go style.
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format interface { MIMEType() string // Returns the mimetype of the document Open(name string) (fs.File, error) // Opens a file inside the package InitScript() string // Returns the initialization script for the engine }
Format needs to be implemented by templateable documents.
type Model ¶
Model defines the data that is passed to the engine for templating. Passed data must be a primitive or a map.
type PackagedDocument ¶
type PackagedDocument struct {
// contains filtered or unexported fields
}
PackageDocument represents a templateable document.
func NewFromFile ¶
func NewFromFile(path string) (*PackagedDocument, error)
NewFromFile returns a new packaged document instance for the given file path. TODO: make this factory function smarter and not only check the file extension, but also the MIME type of the file.
func (*PackagedDocument) Write ¶
func (p *PackagedDocument) Write(model *Model, out io.Writer) (*ProcessingData, error)
Write runs the packaged document through the templating engine using the given model and writes a new packaged document on the writer.
Click to show internal directories.
Click to hide internal directories.