Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document interface { Title() string Description() string Shortform() template.HTML Tags() []string Meta() map[DocumentKey]interface{} HTML() []DocumentSection }
Document to be rendered or indexed
type DocumentKey ¶
type DocumentKey string
DocumentKey provides additional metadata for a document
const ( DocumentKeyTitle DocumentKey = "title" DocumentKeyDescription DocumentKey = "description" DocumentKeyShortform DocumentKey = "shortform" DocumentKeyAuthor DocumentKey = "author" DocumentKeyArtwork DocumentKey = "artwork" DocumentKeyThumbnail DocumentKey = "thumbnail" DocumentKeyContentType DocumentKey = "mimetype" DocumentKeyCharset DocumentKey = "charset" )
type DocumentSection ¶
type DocumentSection interface { // Title for the section Title() string // Level of the section, or zero if no level defined Level() uint // Valid HTML for the section (which allows extraction into text tokens) HTML() template.HTML // Anchor name for the section, if any Anchor() string // Class name for the section, if any Class() string }
DocumentSection represents document HTML, split into sections
type Env ¶ added in v1.0.32
type Env interface { // GetString returns a string value for key, or ErrNotFound GetString(string) (string, error) }
Env interface returns an environment variable
type EventQueue ¶
type EventQueue interface { Post(context.Context, Event) Subscribe(context.Context, chan<- Event) error }
Queue allows posting events and subscription to events from other plugins
type Logger ¶
type Logger interface { Print(context.Context, ...interface{}) Printf(context.Context, string, ...interface{}) }
Logger providers a logging interface
type Middleware ¶
type Middleware interface { // Add a child handler object which intercepts a handler AddMiddleware(context.Context, http.Handler) http.Handler // Add a child handler function which intercepts a handler function AddMiddlewareFunc(context.Context, http.HandlerFunc) http.HandlerFunc }
Middleware intercepts HTTP requests
type Plugin ¶
type Plugin interface { // Run plugin background tasks until cancelled Run(context.Context, Provider) error }
Plugin provides handlers to server
type Provider ¶
type Provider interface { Logger Router Env EventQueue // Plugins returns a list of registered plugin names Plugins() []string // GetPlugin returns a named plugin or nil if not available GetPlugin(context.Context, string) Plugin // GetConfig populates yaml config GetConfig(context.Context, interface{}) error }
Provider provides services to a module
type Renderer ¶
type Renderer interface { Plugin // Return default mimetypes and file extensions handled by this renderer Mimetypes() []string // Render a file into a document, with reader and optional file info and metadata Read(context.Context, io.Reader, fs.FileInfo, map[DocumentKey]interface{}) (Document, error) // Render a directory into a document, with optional file info and metadata ReadDir(context.Context, fs.ReadDirFile, fs.FileInfo, map[DocumentKey]interface{}) (Document, error) }
Renderer translates a data stream into a document
type Router ¶
type Router interface { AddHandler(context.Context, http.Handler, ...string) error AddHandlerFunc(context.Context, http.HandlerFunc, ...string) error AddHandlerFuncEx(context.Context, *regexp.Regexp, http.HandlerFunc, ...string) error }
Router allows handlers to be added for serving URL paths
Click to show internal directories.
Click to hide internal directories.