render

package
v0.24.8 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 19 Imported by: 1

Documentation

Overview

Text template rendering. ( everything is "internal" because text templates generate the commands;

nothing is exposed for authors. )

Index

Constants

This section is empty.

Variables

View Source
var Z_Types = typeinfo.TypeSet{
	Name: "render",
	Comment: []string{
		"Text template rendering.",
		"( everything is \"internal\" because text templates generate the commands;",
		" nothing is exposed for authors. )",
	},

	Slot:       z_slot_list,
	Flow:       z_flow_list,
	Signatures: z_signatures,
}

package listing of type data

View Source
var Zt_RenderEval = typeinfo.Slot{
	Name: "render_eval",
	Markup: map[string]any{
		"--":       "Used with render pattern for arguments of unknown type.",
		"internal": true,
	},
}

render_eval, a type of slot.

View Source
var Zt_RenderName typeinfo.Flow

render_name, a type of flow.

View Source
var Zt_RenderPattern typeinfo.Flow

render_pattern, a type of flow.

View Source
var Zt_RenderResponse typeinfo.Flow

render_response, a type of flow.

View Source
var Zt_RenderValue typeinfo.Flow

render_value, a type of flow.

View Source
var Zt_UnknownDot typeinfo.Flow

unknown_dot, a type of flow.

Functions

func Register added in v0.24.7

func Register(reg func(any))

gob like registration

Types

type RenderEval

type RenderEval interface {
	RenderEval(run rt.Runtime, hint affine.Affinity) (rt.Value, error)
}

helps patterns handle values when the affinity isn't known in advance

type RenderEval_Slot

type RenderEval_Slot struct{ Value RenderEval }

Holds a single slot.

func (*RenderEval_Slot) TypeInfo

func (*RenderEval_Slot) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a single slot.

type RenderEval_Slots

type RenderEval_Slots []RenderEval

Holds a slice of slots.

func (*RenderEval_Slots) Repeats

func (op *RenderEval_Slots) Repeats() bool

Implements typeinfo.Repeats for a slice of slots.

func (*RenderEval_Slots) TypeInfo

func (*RenderEval_Slots) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of slots.

type RenderName

type RenderName struct {
	Name   string
	Markup map[string]any `json:",omitempty"`
}

Handles changing a template like {.boombip} into text. If the name is a variable containing an object name: return the printed object name ( via "print name" ); if the name is a variable with some other text: return that text; if the name isn't a variable but refers to some object: return that object's printed object name; otherwise, its an error.

func (*RenderName) GetMarkup

func (op *RenderName) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RenderName) GetText

func (op *RenderName) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*RenderName) TypeInfo

func (*RenderName) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RenderName_Slice

type RenderName_Slice []RenderName

Holds a slice of type RenderName.

func (*RenderName_Slice) Repeats

func (op *RenderName_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RenderName.

func (*RenderName_Slice) TypeInfo

func (*RenderName_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RenderName.

type RenderPattern

type RenderPattern struct {
	PatternName string
	Render      []RenderEval
	Markup      map[string]any `json:",omitempty"`
}

A version of core's call pattern that figures out how to evaluate its arguments at runtime.

func (*RenderPattern) Execute

func (op *RenderPattern) Execute(run rt.Runtime) error

func (*RenderPattern) GetBool

func (op *RenderPattern) GetBool(run rt.Runtime) (rt.Value, error)

func (*RenderPattern) GetMarkup

func (op *RenderPattern) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RenderPattern) GetNum added in v0.24.6

func (op *RenderPattern) GetNum(run rt.Runtime) (rt.Value, error)

func (*RenderPattern) GetNumList

func (op *RenderPattern) GetNumList(run rt.Runtime) (rt.Value, error)

func (*RenderPattern) GetRecord

func (op *RenderPattern) GetRecord(run rt.Runtime) (rt.Value, error)

func (*RenderPattern) GetRecordList

func (op *RenderPattern) GetRecordList(run rt.Runtime) (rt.Value, error)

func (*RenderPattern) GetText

func (op *RenderPattern) GetText(run rt.Runtime) (ret rt.Value, err error)

expressions are text patterns... so for now adapt via text ideally could generate the buffer based on the pattern type at assembly type

func (*RenderPattern) GetTextList

func (op *RenderPattern) GetTextList(run rt.Runtime) (rt.Value, error)

func (*RenderPattern) RenderEval

func (op *RenderPattern) RenderEval(run rt.Runtime, hint affine.Affinity) (ret rt.Value, err error)

one of the above evals might be called, or this might be called directly from a different pattern the hint tells us what return value type is expected.

func (*RenderPattern) TypeInfo

func (*RenderPattern) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RenderPattern_Slice

type RenderPattern_Slice []RenderPattern

Holds a slice of type RenderPattern.

func (*RenderPattern_Slice) Repeats

func (op *RenderPattern_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RenderPattern.

func (*RenderPattern_Slice) TypeInfo

func (*RenderPattern_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RenderPattern.

type RenderResponse

type RenderResponse struct {
	Name   string
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Generate text in a replaceable manner.

func (*RenderResponse) Execute

func (op *RenderResponse) Execute(run rt.Runtime) (err error)

prints the response via the runtime's writer.

func (*RenderResponse) GetMarkup

func (op *RenderResponse) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RenderResponse) GetText

func (op *RenderResponse) GetText(run rt.Runtime) (ret rt.Value, err error)

return the rendered response as a text value.

func (*RenderResponse) TypeInfo

func (*RenderResponse) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RenderResponse_Slice

type RenderResponse_Slice []RenderResponse

Holds a slice of type RenderResponse.

func (*RenderResponse_Slice) Repeats

func (op *RenderResponse_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RenderResponse.

func (*RenderResponse_Slice) TypeInfo

func (*RenderResponse_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RenderResponse.

type RenderValue

type RenderValue struct {
	Value  rtti.Assignment
	Markup map[string]any `json:",omitempty"`
}

Pull a value from an assignment of unknown affinity.

func (*RenderValue) GetMarkup

func (op *RenderValue) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RenderValue) RenderEval

func (op *RenderValue) RenderEval(run rt.Runtime, hint affine.Affinity) (ret rt.Value, err error)

func (*RenderValue) TypeInfo

func (*RenderValue) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RenderValue_Slice

type RenderValue_Slice []RenderValue

Holds a slice of type RenderValue.

func (*RenderValue_Slice) Repeats

func (op *RenderValue_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RenderValue.

func (*RenderValue_Slice) TypeInfo

func (*RenderValue_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RenderValue.

type UnknownDot added in v0.24.6

type UnknownDot struct {
	Name   rtti.TextEval
	Dot    []object.Dot
	Markup map[string]any `json:",omitempty"`
}

Pull a value from name that might refer either to a variable, or to an object. This gets used by text templates when processing names. The templates don't attempt to determine which names are objects and which names are variables. For instance:

  • Say: "{.story.title} by {.story.author}"

uses UnknownDot for accessing "story".

func (*UnknownDot) GetBool added in v0.24.6

func (op *UnknownDot) GetBool(run rt.Runtime) (ret rt.Value, err error)

func (*UnknownDot) GetMarkup added in v0.24.6

func (op *UnknownDot) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*UnknownDot) GetNum added in v0.24.6

func (op *UnknownDot) GetNum(run rt.Runtime) (ret rt.Value, err error)

func (*UnknownDot) GetNumList added in v0.24.6

func (op *UnknownDot) GetNumList(run rt.Runtime) (ret rt.Value, err error)

func (*UnknownDot) GetRecord added in v0.24.6

func (op *UnknownDot) GetRecord(run rt.Runtime) (ret rt.Value, err error)

func (*UnknownDot) GetRecordList added in v0.24.6

func (op *UnknownDot) GetRecordList(run rt.Runtime) (ret rt.Value, err error)

func (*UnknownDot) GetText added in v0.24.6

func (op *UnknownDot) GetText(run rt.Runtime) (ret rt.Value, err error)

GetText handles unpacking a text variable, turning an object variable into an id, or looking for an object of the passed name ( if no variable of the name exists. )

func (*UnknownDot) GetTextList added in v0.24.6

func (op *UnknownDot) GetTextList(run rt.Runtime) (ret rt.Value, err error)

func (*UnknownDot) RenderEval added in v0.24.6

func (op *UnknownDot) RenderEval(run rt.Runtime, hint affine.Affinity) (ret rt.Value, err error)

func (*UnknownDot) TypeInfo added in v0.24.6

func (*UnknownDot) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type UnknownDot_Slice added in v0.24.6

type UnknownDot_Slice []UnknownDot

Holds a slice of type UnknownDot.

func (*UnknownDot_Slice) Repeats added in v0.24.6

func (op *UnknownDot_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of UnknownDot.

func (*UnknownDot_Slice) TypeInfo added in v0.24.6

func (*UnknownDot_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of UnknownDot.

Jump to

Keyboard shortcuts

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