renderer

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: 2 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks interface {
	PageCallbacks
	Includer
	NextIncludeLevel() (bool, error)
}

type CodeBlock

type CodeBlock struct {
	Language string
	Source   string
}

type ExpressionKind

type ExpressionKind uint8
const (
	ExprNone ExpressionKind = iota
	ExprString
	ExprBool
	ExprFloat
	ExprInt
)

type ExpressionResult

type ExpressionResult struct {
	Kind  ExpressionKind
	Str   string
	Bool  bool
	Float float64
	Int   int64
}

func BoolExpr

func BoolExpr(v bool) ExpressionResult

func FloatExpr

func FloatExpr(v float64) ExpressionResult

func IntExpr

func IntExpr(v int64) ExpressionResult

func StringExpr

func StringExpr(v string) ExpressionResult

type Fake

type Fake struct {
	Result Result
	Parts  Parts
	Err    error
	Calls  []FakeCall
}
func (f *Fake) CollectBacklinks(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Result, error)

func (*Fake) CollectCodeAndHTML

func (f *Fake) CollectCodeAndHTML(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Parts, error)

func (*Fake) RenderHTML

func (f *Fake) RenderHTML(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Result, error)

func (*Fake) RenderText

func (f *Fake) RenderText(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Result, error)

type FakeCall

type FakeCall struct {
	Op     string
	Source string
	Info   PageInfo
	Mode   Mode
}

type FetchedPage

type FetchedPage struct {
	FullName string
	Content  *string
}

type IncludeRef

type IncludeRef struct {
	FullName  string
	Variables map[string]string
}

type Includer

type Includer interface {
	IncludePages(refs []IncludeRef) ([]FetchedPage, error)
	NoSuchInclude(fullName string) (string, error)
}

type Mode

type Mode string
const (
	ModeArticle           Mode = "article"
	ModeMessage           Mode = "message"
	ModeInline            Mode = "inline"
	ModeSystem            Mode = "system"
	ModeSystemWithModules Mode = "system-with-modules"
)

func (Mode) Valid

func (m Mode) Valid() bool

type NopCallbacks

type NopCallbacks struct{}

func (NopCallbacks) EvaluateExpression

func (NopCallbacks) EvaluateExpression(string) (ExpressionResult, error)

func (NopCallbacks) GetHTMLInjectedCode

func (NopCallbacks) GetHTMLInjectedCode(string) (string, error)

func (NopCallbacks) GetI18nMessage

func (NopCallbacks) GetI18nMessage(string) (string, error)

func (NopCallbacks) GetPageInfo

func (NopCallbacks) GetPageInfo([]string) ([]PartialPageInfo, error)

func (NopCallbacks) IncludePages

func (NopCallbacks) IncludePages([]IncludeRef) ([]FetchedPage, error)

func (NopCallbacks) ModuleHasBody

func (NopCallbacks) ModuleHasBody(string) (bool, error)

func (NopCallbacks) ModuleIsInline

func (NopCallbacks) ModuleIsInline(string) (bool, error)

func (NopCallbacks) NextIncludeLevel

func (NopCallbacks) NextIncludeLevel() (bool, error)

func (NopCallbacks) NoSuchInclude

func (NopCallbacks) NoSuchInclude(string) (string, error)

func (NopCallbacks) NormalizePageName

func (NopCallbacks) NormalizePageName(name string) (string, error)

func (NopCallbacks) RenderModule

func (NopCallbacks) RenderModule(string, map[string]string, string) (string, error)

func (NopCallbacks) RenderUser

func (NopCallbacks) RenderUser(string, bool) (string, error)

type PageCallbacks

type PageCallbacks interface {
	ModuleHasBody(name string) (bool, error)
	ModuleIsInline(name string) (bool, error)
	RenderModule(name string, params map[string]string, body string) (string, error)
	RenderUser(user string, avatar bool) (string, error)
	GetI18nMessage(id string) (string, error)
	GetHTMLInjectedCode(id string) (string, error)
	GetPageInfo(refs []string) ([]PartialPageInfo, error)
	EvaluateExpression(expr string) (ExpressionResult, error)
	NormalizePageName(fullName string) (string, error)
}

type PageInfo

type PageInfo struct {
	Page        string
	Category    string
	Site        string
	Title       string
	Domain      string
	MediaDomain string
	Rating      float64
	Tags        []string
	Language    string
}

type PartialPageInfo

type PartialPageInfo struct {
	FullName string
	Title    *string
	Exists   bool
}

type Parts

type Parts struct {
	Code []CodeBlock
	HTML []string
}

type Renderer

type Renderer interface {
	RenderHTML(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Result, error)
	RenderText(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Result, error)
	CollectBacklinks(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Result, error)
	CollectCodeAndHTML(ctx context.Context, source string, info PageInfo, cb Callbacks, mode Mode) (Parts, error)
}

type Result

type Result struct {
	Body          string
	IncludedPages []string
	LinkedPages   []string
	Code          []CodeBlock
	HTML          []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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