staticdir

package module
v0.0.0-...-57a7490 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2014 License: GPL-3.0 Imports: 5 Imported by: 2

README

staticdir

See documention on godoc.

Documentation

Overview

package staticdir provides tools for transforming "resource" files such as templated HTML into static content

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColdCopy

func ColdCopy(source, target string, fi os.FileInfo,
	data interface{}) error

ColdCopy simply copies a source file to a target file, discarding other parameters.

func ExcludeNone

func ExcludeNone(fi os.FileInfo) bool

func GetChildren

func GetChildren(path string) (fis []os.FileInfo, err error)

GetChildren retrieves all fileinfos contained by a directory.

func TemplateCopy

func TemplateCopy(source, target string, fi os.FileInfo,
	data interface{}) error

TemplateCopy copies a source file to a target file, discarding other parameters, unless it has the extension ".tmpl", in which case it is read as a template, and executed into the target file with the data. The extension is removed. The template engine is documented at html/template.

Types

type Translator

type Translator struct {
	Source, Target string

	// ExcludeDir and ExcludeFile are used for determining if a file
	// or directory should not be copied from the source to the target
	// directory.
	ExcludeDir  func(os.FileInfo) bool
	ExcludeFile func(os.FileInfo) bool

	// CopyFunc is called when copying a source file to the target
	// directory, after it has already been checked with
	// ExcludeFile. It is passed the path to the source file, target
	// file, the source fileinfo, and CopyData, which can be anything.
	CopyFunc func(string, string, os.FileInfo, interface{}) error
	CopyData interface{}
}

func New

func New(source, target string) *Translator

func (*Translator) CopyDir

func (t *Translator) CopyDir(subpath string) error

func (*Translator) CopyFile

func (t *Translator) CopyFile(subpath string, fi os.FileInfo) error

func (*Translator) Translate

func (t *Translator) Translate() error

Jump to

Keyboard shortcuts

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