Documentation ¶
Overview ¶
package placesmap provides a places.Mapper to allow embedding of templates, escaping etc
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidPrefix = errors.New("prefix does not match the regular expression ^[a-z]+$")
View Source
var HTMLEscape = MapFunc(html.EscapeString)
View Source
var UrlEscape = MapFunc(url.QueryEscape)
Functions ¶
This section is empty.
Types ¶
type HTMLTemplate ¶
func NewHTMLTemplate ¶
func NewHTMLTemplate(rs *ReadSeekerMap) *HTMLTemplate
func (*HTMLTemplate) NewMapper ¶
func (h *HTMLTemplate) NewMapper(m map[string]places.Mapper) *HTMLTemplateMapper
type HTMLTemplateMapper ¶
type HTMLTemplateMapper struct { sync.Mutex *HTMLTemplate // contains filtered or unexported fields }
func (*HTMLTemplateMapper) Map ¶
func (h *HTMLTemplateMapper) Map(input string) string
type Map ¶
type Map interface { places.Mapper // Add registers a mapper in the registry for the given prefix // If there is already a mapper for the given prefix, it will be overwritten // If prefix does not conform to the regular expression ^[a-z]+$, ErrInvalidPrefix is returned Add(prefix string, mapper places.Mapper) error }
Map is a registry of places.Mappers and itself a places.Mapper
func NewConcurrent ¶
func NewConcurrent() Map
NewConcurrent returns a new Map that is safe for concurrent use.
type MapperAlreadyExistsError ¶
type MapperAlreadyExistsError string
func (MapperAlreadyExistsError) Error ¶
func (m MapperAlreadyExistsError) Error() string
type ReadSeekerAlreadyExistsError ¶
type ReadSeekerAlreadyExistsError string
func (ReadSeekerAlreadyExistsError) Error ¶
func (m ReadSeekerAlreadyExistsError) Error() string
type ReadSeekerMap ¶
type ReadSeekerMap struct {
// contains filtered or unexported fields
}
ReadSeekerMap is a map of strings to io.ReadSeeker that may be used concurrently
func (*ReadSeekerMap) Add ¶
func (r *ReadSeekerMap) Add(name string, rs io.ReadSeeker) error
Add adds an io.ReadSeeker for the given name. If there is already a ReadSeeker defined for the given name, an error is returned. There are no restrictions for the name
func (*ReadSeekerMap) Map ¶
func (r *ReadSeekerMap) Map(name string) (val string)
type RootDoesNotExistError ¶
type RootDoesNotExistError string
func (RootDoesNotExistError) Error ¶
func (r RootDoesNotExistError) Error() string
type RootIsNotDirectoryError ¶
type RootIsNotDirectoryError string
func (RootIsNotDirectoryError) Error ¶
func (r RootIsNotDirectoryError) Error() string
type TemplateLoader ¶
type TemplateLoader struct { *ReadSeekerMap // contains filtered or unexported fields }
TemplateLoader loads templates recursively from a root directory for a given file extension
func NewTemplateLoader ¶
func NewTemplateLoader(rootDir string, extension string, ignoreDirs *regexp.Regexp) *TemplateLoader
func (*TemplateLoader) Load ¶
func (l *TemplateLoader) Load() (*ReadSeekerMap, error)
Click to show internal directories.
Click to hide internal directories.