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 File() DocumentFile Meta() map[DocumentKey]interface{} HTML() []DocumentSection }
Document to be rendered or indexed
type DocumentFile ¶
type DocumentFile interface { // Name of the file, including the file extension Name() string // Parent path for the file, not including the filename Path() string // Extension for the file, including the "." Ext() string // Last modification time for the document ModTime() time.Time // Size in bytes Size() int64 }
DocumentFile represents a document materialized on a file system
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" DocumentKeyMimetype DocumentKey = "mimetype" )
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 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 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 Read(context.Context, io.Reader, fs.FileInfo) (Document, error) // Render a directory into a document, with optional file info ReadDir(context.Context, fs.ReadDirFile, fs.FileInfo) (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.