Documentation ¶
Index ¶
Constants ¶
View Source
const ( TextHtml = "text/html" ApplicationXhtml = "application/xhtml+xml" )
Variables ¶
View Source
var ContentType = TextHtml
ContentType is the value returned when serving HTML files. This defaults to TextHtml, but set it to ApplicationXhtml if more appropriate.
View Source
var Fs = afero.NewOsFs()
Functions ¶
This section is empty.
Types ¶
type HTMLProcessor ¶ added in v0.3.0
type HTMLProcessor interface { render.HTMLRender ResponseProcessor }
func LoadTemplates ¶
func LoadTemplates(dir, suffix string, funcMap template.FuncMap) HTMLProcessor
LoadTemplates finds all the templates in the directory dir and its subdirectories that have names ending with the given suffix. The function map can be nil if not required.
type ResponseProcessor ¶ added in v0.3.0
type ResponseProcessor interface { // CanProcess is the predicate that determines whether this processor // will handle a given request. CanProcess(mediaRange string, lang string) bool // ContentType returns the content type for this response. ContentType() string // Process renders the data model to the response writer, without setting any headers. // If the processor encounters an error, it should panic. Process(w http.ResponseWriter, template string, dataModel interface{}) error }
ResponseProcessor interface creates the contract for custom content negotiation. This matches processor.ResponseProcessor (github.com/rickb777/negotiator) without introducing an explicit dependency.
Click to show internal directories.
Click to hide internal directories.