callbacks

package
v0.9.0-rc.53 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MaxIncludeLevel = 10
	// Pages that include themselves or each other grow several times over per
	// level, so the level alone does not keep a render finite.
	MaxIncludedBytes = 30 << 20
)

Variables

View Source
var (
	ErrUserNotFound = errors.New("user not found")
	ErrNoRepository = errors.New("no repository configured")
)

Functions

This section is empty.

Types

type Callbacks

type Callbacks struct {
	// contains filtered or unexported fields
}

func New

func New(loc *i18n.Localizer, repo Repository) *Callbacks

func (*Callbacks) EvaluateExpression

func (c *Callbacks) EvaluateExpression(source string) (renderer.ExpressionResult, error)

func (*Callbacks) GetHTMLInjectedCode

func (c *Callbacks) GetHTMLInjectedCode(id string) (string, error)

func (*Callbacks) GetI18nMessage

func (c *Callbacks) GetI18nMessage(id string) (string, error)

func (*Callbacks) GetPageInfo

func (c *Callbacks) GetPageInfo(refs []string) ([]renderer.PartialPageInfo, error)

func (*Callbacks) IncludePages

func (c *Callbacks) IncludePages(refs []renderer.IncludeRef) ([]renderer.FetchedPage, error)

func (*Callbacks) ModuleHasBody

func (c *Callbacks) ModuleHasBody(name string) (bool, error)

func (*Callbacks) ModuleIsInline

func (c *Callbacks) ModuleIsInline(name string) (bool, error)

func (*Callbacks) NextIncludeLevel

func (c *Callbacks) NextIncludeLevel() (bool, error)

func (*Callbacks) NoSuchInclude

func (c *Callbacks) NoSuchInclude(fullName string) (string, error)

A ref that named another wiki gets one answer for every way it can fail, so the block cannot be used to tell a missing page from an unreadable one.

func (*Callbacks) NormalizePageName

func (c *Callbacks) NormalizePageName(fullName string) (string, error)

func (*Callbacks) RenderModule

func (c *Callbacks) RenderModule(name string, params map[string]string, body string) (string, error)

func (*Callbacks) RenderUser

func (c *Callbacks) RenderUser(username string, avatar bool) (string, error)

func (*Callbacks) SetContext

func (c *Callbacks) SetContext(pc *page.Context)

SetContext hands the modules the page they are rendering into, which is what lets one of them redirect the whole request or set the description.

func (*Callbacks) SetPageVars

func (c *Callbacks) SetPageVars(vars *page.Vars)

SetPageVars names the page whose %%this|x%% an included page reaches. Without it every such name is left standing.

func (*Callbacks) SetSite

func (c *Callbacks) SetSite(slug string)

type ModuleError

type ModuleError struct{ Message string }

func (*ModuleError) Error

func (e *ModuleError) Error() string

type Repository

type Repository interface {
	RenderModule(pc *page.Context, name string, params map[string]string, body string) (string, error)
	RenderUser(username string, avatar bool) (string, error)
	PageInfo(refs []string) ([]renderer.PartialPageInfo, error)

	// IncludeSources answers one page per ref, in the order it was asked.
	IncludeSources(refs []renderer.IncludeRef) ([]renderer.FetchedPage, error)
}

Jump to

Keyboard shortcuts

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