view

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 17 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

Overview

Package view renders a SysML view: it turns the elements a view exposes into a rendering artifact, in the form the view's `render` member states.

SysML v2 §10.2 states which rendering a view uses and leaves how a tool carries it out to the tool, so everything this package produces — the text form and the Mermaid form alike — is tool-defined output rather than a notation the specification defines. What is read from the model is not: the exposed set comes from semantics.Model.ExposedElements, connections from the model's own connector information, and states and actions from the lowered graphs in internal/core/lower, never from the source text of a declaration.

Index

Constants

View Source
const PseudoViewPrefix = "#"

PseudoViewPrefix marks a rendering of exposed elements rather than a declared view.

View Source
const (
	// WidthUnbounded writes every column as wide as its widest cell, which is
	// what a form written to a file or a pipe rather than a terminal is.
	WidthUnbounded = 0
)

The widths the text form is written to.

Variables

View Source
var ErrUnknownPalette = errors.New("unknown palette")

ErrUnknownPalette is a palette name that names none. UnknownPaletteError wraps it.

View Source
var ErrUnsupportedKind = errors.New("unsupported rendering kind")

ErrUnsupportedKind is the rendering kind a view states that this package does not produce. UnsupportedKindError wraps it, so a caller can test for it without knowing which kind was asked for.

View Source
var ErrWrongForm = errors.New("rendering is not written in that form")

ErrWrongForm is a form asked for that renderings of the kind are not written in. WrongFormError wraps it.

Functions

func FormNames added in v0.8.0

func FormNames(forms []Form) string

FormNames spells the forms as a list, for help and error text.

func PaletteNames added in v0.8.0

func PaletteNames() string

PaletteNames spells the palettes as a list, for help and error text.

func PseudoViewSpecs added in v0.3.1

func PseudoViewSpecs() []string

PseudoViewSpecs names the supported pseudo-views in sorted order.

func TableColumns added in v0.5.0

func TableColumns() []string

TableColumns are the headings a tabular rendering carries when it names none.

Types

type Canvas added in v0.8.0

type Canvas struct {
	Unit          string
	Width, Height float64
	HasSize       bool
}

Canvas is the drawing surface a view states with DiagramLayout::Canvas: its unit, and its extent when HasSize.

type Data added in v0.1.2

type Data struct {
	// View is the rendered view by qualified name, "" for a rendering of exposed
	// elements alone (RenderExposed).
	View string
	// Kind is the rendering produced, and Stated how the kind was decided.
	Kind   Kind
	Stated string
	// Nodes are every node of the rendering, parents before children, each
	// naming its parent.
	Nodes []NodeData
	// Edges join nodes by ID.
	Edges []EdgeData
	// Columns and Rows are the tabular rendering, empty for every other kind.
	Columns []string
	Rows    []RowData
	// Canvas is the drawing surface the view states, nil for none.
	Canvas *Canvas
	// Notices are what the rendering could not represent.
	Notices []string
}

Data is the machine-consumable shape of a Rendering: the nodes flattened out of the containment tree, the edges between them, the rows of a tabular rendering and what the rendering could not represent. It carries no protocol or wire concern — a caller speaking one converts it.

type Direction added in v0.4.2

type Direction string

Direction is the flow direction a graph-shaped rendering is drawn in, as Mermaid names them.

const (
	DirectionTopBottom Direction = "TB"
	DirectionLeftRight Direction = "LR"
	DirectionRightLeft Direction = "RL"
	DirectionBottomTop Direction = "BT"
)

func ParseDirection added in v0.4.2

func ParseDirection(name string) (Direction, bool)

ParseDirection reports the direction name names, and whether it names one.

type Drawn added in v0.8.0

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

Drawn is what one rendering of a view draws: the elements it positions as nodes and those it steers as edges, by their declarations.

func (*Drawn) Edge added in v0.8.0

func (d *Drawn) Edge(sym *symbols.Symbol) bool

Edge reports whether the rendering draws sym as an edge a Route steers.

func (*Drawn) Node added in v0.8.0

func (d *Drawn) Node(sym *symbols.Symbol) bool

Node reports whether the rendering draws sym as a node a Layout positions.

type Edge

type Edge struct {
	// From and To are node IDs.
	From string
	To   string
	// Label is what the edge carries: a connector's name, a transition's
	// trigger, guard and effect, a succession's guard. It may be empty.
	Label string
	Kind  EdgeKind
	// Origin is where the connection, transition, succession or flow was
	// declared, the zero Origin for one with no locatable declaration.
	Origin Origin
	// Route is the waypoints the edge follows, from the Route annotation of the
	// element it was declared as; empty leaves the routing to the writer.
	Route []Point
}

Edge joins two nodes of a rendering.

type EdgeData added in v0.1.2

type EdgeData struct {
	From   string
	To     string
	Label  string
	Kind   EdgeKind
	Origin Origin
	// Route is the waypoints the edge follows, empty when no Route gives any.
	Route []Point
}

EdgeData is one edge of a rendering, joining two node IDs.

type EdgeKind

type EdgeKind int

EdgeKind classifies what an edge of a rendering stands for.

const (
	// EdgeConnection is a connector joining two features.
	EdgeConnection EdgeKind = iota
	// EdgeTransition is a state transition.
	EdgeTransition
	// EdgeSuccession is a succession between action nodes.
	EdgeSuccession
	// EdgeFlow is a flow of a payload between action nodes.
	EdgeFlow
)

func (EdgeKind) String added in v0.1.2

func (k EdgeKind) String() string

String names an edge kind the way the notation speaks of it.

type Form

type Form string

Form is a written form of a rendering: the human-readable text every kind has, the machine-readable form of the kind — a Mermaid diagram for the graph-shaped kinds, a Markdown table for the tabular one — and the Graphviz DOT and PlantUML forms a graph-shaped kind can be asked for instead.

const (
	// FormText is the human-readable form, which the REPL prints.
	FormText Form = "text"
	// FormMermaid is a Mermaid diagram of a graph-shaped rendering.
	FormMermaid Form = "mermaid"
	// FormMarkdown is a Markdown table of a tabular rendering.
	FormMarkdown Form = "markdown"
	// FormDot is a Graphviz DOT digraph of a graph-shaped rendering.
	FormDot Form = "dot"
	// FormPlantUML is a PlantUML diagram of a graph-shaped or sequence rendering.
	FormPlantUML Form = "plantuml"
)

func DiagramForms added in v0.8.0

func DiagramForms() []Form

DiagramForms are the forms a document render writes its graph-shaped diagrams as; a table-kind view is written as a table whichever is chosen.

func Forms

func Forms() []Form

Forms are the forms a rendering can be asked for, in the order they are offered.

func (Form) TakesPalette added in v0.8.0

func (f Form) TakesPalette() bool

TakesPalette reports whether the form fills nodes from a palette.

type Geometry added in v0.8.0

type Geometry struct {
	X, Y          float64
	Width, Height float64
	HasSize       bool
	Collapsed     bool
}

Geometry is where a node is drawn, from the DiagramLayout::Layout positioning it in the rendered view; HasSize says whether Width and Height were given.

type Kind

type Kind string

Kind is a rendering a view can state. The kinds this package produces are tree, interconnection, state, action, table and sequence; the rest are recognized so that a view stating one is told it is unsupported rather than rendered as something else. A rendering the standard library does not declare is carried as the name the model gives it, so an error about it names what the view asked for.

const (
	// KindTree renders the exposed elements as a containment tree.
	KindTree Kind = "tree"
	// KindInterconnection renders exposed features as nodes and the connections
	// between them as edges.
	KindInterconnection Kind = "interconnection"
	// KindState renders the states and transitions of exposed behaviors.
	KindState Kind = "state"
	// KindAction renders the nodes and successions of exposed behaviors.
	KindAction Kind = "action"
	// KindTextual is Views::asTextualNotation, which writes the model back as
	// notation: `sysml -convert sysml` does that, so no rendering is produced.
	KindTextual Kind = "textual"
	// KindTable renders the exposed elements as rows of a table, which is
	// Views::asElementTable and StandardViewDefinitions::GridView.
	KindTable Kind = "table"
	// KindSequence renders exposed occurrences as lifelines and the flows
	// between them as ordered messages, which is
	// StandardViewDefinitions::SequenceView.
	KindSequence Kind = "sequence"
	// KindGeometry is StandardViewDefinitions::GeometryView.
	KindGeometry Kind = "geometry"
)

func Kinds added in v0.4.3

func Kinds() []Kind

Kinds returns every rendering kind this package recognizes, supported or not.

func ParsePseudoView added in v0.3.1

func ParsePseudoView(spec string) (Kind, string, bool)

ParsePseudoView parses #<kind> or #<kind>:<target>.

func PseudoViewKind added in v0.3.1

func PseudoViewKind(name string) (Kind, bool)

PseudoViewKind reports the supported rendering kind named by name.

func (Kind) MachineForm

func (k Kind) MachineForm() Form

MachineForm is the machine-readable form of renderings of this kind.

func (Kind) Supported

func (k Kind) Supported() bool

Supported reports whether this package produces a rendering of the kind.

func (Kind) SupportedForms added in v0.8.0

func (k Kind) SupportedForms() []Form

SupportedForms are the forms renderings of the kind are written in, in the order Forms offers them.

func (Kind) SupportsDirection added in v0.4.2

func (k Kind) SupportsDirection() bool

SupportsDirection reports whether a rendering of the kind is drawn as a graph a direction can be stated for: a flowchart or a state diagram. A table has no direction, and a sequence diagram always reads top-down.

func (Kind) SupportsForm added in v0.8.0

func (k Kind) SupportsForm(form Form) bool

SupportsForm reports whether renderings of the kind are written in form: every kind has the text form and its machine form, the kinds drawn as a graph of nodes and edges have the DOT and PlantUML forms as well, and a sequence has PlantUML's sequence grammar.

func (Kind) SupportsPalette added in v0.8.0

func (k Kind) SupportsPalette() bool

SupportsPalette reports whether a rendering of the kind is drawn as nodes a palette can fill: the kinds a form that fills nodes is written for.

type Node

type Node struct {
	// ID identifies the node within its rendering, and is what an edge names.
	ID string
	// Kind is what the notation calls the element — "part def", "state",
	// "fork" — never a Go type name.
	Kind string
	// Name is the element's name: qualified for a node the view exposes, simple
	// for one nested in it. It is empty for an anonymous element.
	Name string
	// Type is the declared type of a typed usage, as the notation writes it
	// after the colon. It is empty for a definition or an untyped usage.
	Type string
	// Detail is what else the rendering says about the node, such as a state's
	// "initial" or "already shown". It is empty when there is nothing to add.
	Detail string
	// Children are the nodes nested in this one.
	Children []*Node
	// Origin is where the element was declared, the zero Origin for one with no
	// locatable declaration.
	Origin Origin
	// Geometry is where the element is drawn, from the Layout annotation that
	// positions it in this view; nil leaves the placement to the writer.
	Geometry *Geometry
}

Node is one element of a rendering: an exposed element, a feature nested in one, a state or an action node, or the "start" of a state body, which its entry transitions leave. Children are the nodes nested in it, which is how a rendering carries containment.

type NodeData added in v0.1.2

type NodeData struct {
	ID     string
	Kind   string
	Name   string
	Type   string
	Detail string
	// Parent is the ID of the node this one is nested in, "" for a root.
	Parent string
	Origin Origin
	// Geometry is where the node is drawn, nil when no Layout positions it.
	Geometry *Geometry
}

NodeData is one node of a rendering, with the node it is nested in.

type Options added in v0.8.0

type Options struct {
	// Direction is the flow direction a graph-shaped form is drawn in; empty
	// leaves each kind's default.
	Direction Direction
	// Palette is the palette the DOT and PlantUML forms fill nodes from, by
	// keyword family; empty draws in black and white.
	Palette Palette
	// Width is the width the text form is written to fit; WidthUnbounded
	// writes every column as wide as its widest cell.
	Width int
}

Options are what a rendering is written with beside its form. Each form takes the ones that apply to it: the text form its Width, the Mermaid form its Direction, the DOT and PlantUML forms their Direction and Palette. A form ignores the rest, the Mermaid form saying so of a Palette in a comment.

type Origin added in v0.1.2

type Origin = provenance.Origin

Origin is the source declaration that produced a rendered artifact.

type Palette added in v0.8.0

type Palette string

Palette names the set of fill colours the DOT and PlantUML forms colour nodes with, one per keyword family (part, item, port, …, see paletteFamilies). The empty Palette is the black-and-white default; every named one is colourblind-safe.

const (
	// PaletteOkabeIto is the eight-colour palette of Okabe & Ito, "Color
	// Universal Design" (2002, jfly.uni-koeln.de/color).
	PaletteOkabeIto Palette = "okabe-ito"
	// PaletteTolBright, PaletteTolMuted and PaletteTolLight are Paul Tol's
	// qualitative schemes (personal.sron.nl/~pault, technical note 3.2, 2021).
	PaletteTolBright Palette = "tol-bright"
	PaletteTolMuted  Palette = "tol-muted"
	PaletteTolLight  Palette = "tol-light"
	// PaletteBrewerSet2 and PaletteBrewerDark2 are ColorBrewer's Set2 and
	// Dark2 (Cynthia Brewer, colorbrewer2.org; Apache-2.0, notice below).
	PaletteBrewerSet2  Palette = "brewer-set2"
	PaletteBrewerDark2 Palette = "brewer-dark2"
	// PaletteViridis and PaletteCividis are sequential ramps, sampled at 16
	// stops of matplotlib's colour maps (van der Walt & Smith; Nuñez, Anderton
	// & Renslow 2018), darkest first.
	PaletteViridis Palette = "viridis"
	PaletteCividis Palette = "cividis"
)

func Palettes added in v0.8.0

func Palettes() []Palette

Palettes are the palettes a rendering can be asked for, in the order they are offered.

func ParsePalette added in v0.8.0

func ParsePalette(name string) (Palette, bool)

ParsePalette reports the palette name names, and whether it names one. The empty name is no palette: the black-and-white default is asked for by stating none.

func (Palette) Color added in v0.8.0

func (p Palette) Color(i, n int) string

Color is the palette's colour for category i of n, `#RRGGBB`: a qualitative palette's i-th colour, wrapping round past its last, or a sequential ramp sampled evenly over its stops with category 0 the darkest.

func (Palette) Sequential added in v0.8.0

func (p Palette) Sequential() bool

Sequential reports whether the palette is a ramp sampled to fit the categories drawn, rather than a fixed set of distinct colours.

type Point added in v0.8.0

type Point struct {
	X, Y float64
}

Point is one position on a rendering's canvas, in pixels from the top-left corner, y increasing downward.

type Renderer

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

Renderer renders views over one semantic model.

func NewRenderer

func NewRenderer(model *semantics.Model, resolver *resolve.Resolver, text SourceText) *Renderer

NewRenderer returns a renderer over the model and resolver of a loaded document. text may be nil.

func (*Renderer) DrawnIn added in v0.8.0

func (r *Renderer) DrawnIn(view *symbols.Symbol) (*Drawn, error)

DrawnIn renders view and reports what the rendering draws: the elements a Layout or Route stated in the view's body can apply to. A view that does not render is the error Render gives.

func (*Renderer) DrawsAnywhere added in v0.8.0

func (r *Renderer) DrawsAnywhere(sym *symbols.Symbol) (node, edge bool)

DrawsAnywhere reports whether some rendering kind draws sym as a node and whether some draws it as an edge: what an annotation applying in every view can position.

func (*Renderer) KindOf

func (r *Renderer) KindOf(view *symbols.Symbol) (Kind, string, error)

KindOf reports the rendering kind a view states and how it states it: the rendering its body names, else the standard view definition it specializes, else the tree every view defaults to. A recognized kind this package does not produce is an *UnsupportedKindError.

func (*Renderer) Render

func (r *Renderer) Render(view *symbols.Symbol) (*Rendering, error)

Render renders view in the kind it states, defaulting to a tree when it states none. A view that is no view is semantics.ErrNotAView, and a recognized kind this package does not produce is an *UnsupportedKindError — never another kind's rendering.

func (*Renderer) RenderExposed added in v0.1.2

func (r *Renderer) RenderExposed(exposed []*symbols.Symbol, kind Kind, stated string) (*Rendering, error)

RenderExposed renders elements in the kind asked for, as a view exposing just them would: a document with no view declared is rendered this way. Nothing is added to the model or to the symbol index, so the rendering carries no view name; stated says how the kind was decided. An unsupported kind is an *UnsupportedKindError.

type Rendering

type Rendering struct {
	// View is the rendered view, by qualified name as the notation writes it.
	View string
	// Kind is the rendering produced.
	Kind Kind
	// Stated is how the kind was decided: the rendering member the view states,
	// the standard view definition it specializes, or "" when the view states
	// nothing and the default was used.
	Stated string
	// Roots are the top-level nodes, in the order the view exposes them.
	Roots []*Node
	// Edges join nodes, in the order the model and the lowered graphs give them.
	Edges []Edge
	// Columns are the headings of a tabular rendering, empty for every other
	// kind.
	Columns []string
	// Rows are the rows of a tabular rendering, each holding one cell per
	// column, in the order the view exposes the elements.
	Rows [][]string
	// RowOrigins is where each row's element was declared, one entry per row.
	RowOrigins []Origin
	// Canvas is the drawing surface the view states, nil for a view stating
	// none.
	Canvas *Canvas
	// Notices are what the rendering could not represent, reported rather than
	// dropped: an exposed element with no place in this kind of rendering, a
	// connection to something the view does not expose, a behavior that does not
	// lower.
	Notices []string
	// contains filtered or unexported fields
}

Rendering is what a view renders to: the nodes and edges of one artifact, which Text and Mermaid write out. It is a value, not a live view of the model: nothing in it points back into the AST.

func (*Rendering) Clone added in v0.4.2

func (r *Rendering) Clone() *Rendering

Clone returns a deep copy of the rendering, so a holder can hand it out without letting its nodes or rows be changed underneath it.

func (*Rendering) DOT added in v0.8.0

func (r *Rendering) DOT() (string, error)

DOT is the Graphviz form of a graph-shaped rendering: a `digraph`, written as text like the Mermaid form, with no Graphviz installed. A node with children is a `subgraph "cluster_<id>"` (a tree draws containment as edges, as its Mermaid form does) holding an invisible anchor node `"<id>"`, so an edge keeps the rendering's endpoints and is clipped at the cluster with `lhead`/`ltail` — except at an end that encloses the other, where the edge starts or ends inside it. Edge kinds parallel the Mermaid arrows:

EdgeKind        Mermaid  DOT
EdgeConnection  ---      arrowhead=none
EdgeTransition  -->      solid, default arrowhead
EdgeSuccession  -->      solid, default arrowhead
EdgeFlow        -.->     style=dashed
(containment)   ---      arrowhead=none

DiagramLayout geometry is written as Graphviz reads it (pinned `pos`, `bb`, `pos` splines, pinned canvas corners); docs/project/view-rendering-forms.md#geometry has the rules.

The drawing is in the Standard B&W style of the SysML v2 Pilot visualizer (docs/project/view-rendering-forms.md#style): Helvetica, white fills, thin #181818 lines, square definitions and rounded usages, the keyword line in italics. Defaults are written once as `graph`, `node` and `edge` statements; a node or edge states only what it deviates in, its style before its geometry.

A kind with no DOT counterpart — sequence, table — is a *WrongFormError.

func (*Rendering) DOTWith added in v0.8.0

func (r *Rendering) DOTWith(options Options) (string, error)

DOTWith is the DOT form written with options: laid out in the stated direction, as `rankdir` (the empty direction leaves the engine's default and writes no `rankdir`), and filled from the stated palette by keyword family (the empty palette draws in black and white). The layout is the same whatever the palette: it changes fills and borders alone.

func (*Rendering) Data added in v0.1.2

func (r *Rendering) Data() Data

Data is the rendering in machine-consumable form.

func (*Rendering) Empty

func (r *Rendering) Empty() bool

Empty reports whether the rendering has nothing to show.

func (*Rendering) EmptyReason added in v0.5.0

func (r *Rendering) EmptyReason() string

EmptyReason says why a rendering shows nothing: a view exposing nothing, or a view whose exposed elements this kind of rendering cannot show, which the notices then account for one by one.

func (*Rendering) Markdown

func (r *Rendering) Markdown() string

Markdown is the machine-readable form of a tabular rendering: a GitHub-flavored Markdown table, which is what a table is read as where the models are — in documentation and in an editor — since Mermaid has no table grammar. What the rendering could not represent is written as Markdown comments, so no notice is lost.

func (*Rendering) MarkdownCells added in v0.4.2

func (r *Rendering) MarkdownCells(escape func(string) string) string

MarkdownCells is Markdown with the caller's cell escaping, for a host whose Markdown dialect escapes more than a pipe and a newline.

func (*Rendering) Mermaid

func (r *Rendering) Mermaid() string

Mermaid is the default machine-readable form of a rendering: a Mermaid diagram renders where the models are read — in Markdown documentation, in the repository's own docs, and in the editors that host the language server — without a Graphviz installation, and it has a state-diagram grammar the state rendering maps onto directly. Graphviz DOT, written by DOT, is the alternative for Graphviz toolchains and for renderings that will carry exact positions; PlantUML, written by PlantUML, for PlantUML toolchains.

A graph-shaped rendering is a `flowchart`; a state rendering is a `stateDiagram-v2` and a sequence rendering a `sequenceDiagram`. What the rendering could not represent is written as comments, so no notice is lost in the machine-readable form either.

func (*Rendering) MermaidWith added in v0.8.0

func (r *Rendering) MermaidWith(options Options) string

MermaidWith is the Mermaid form written with options. It is drawn in the stated direction: a flowchart flows that way, and a state diagram states it as a `direction` statement. The empty direction keeps each kind's default, and a kind no direction applies to ignores it. A palette is not drawn, Mermaid having no fill per node kind, and is noted as not represented.

func (*Rendering) PlantUML added in v0.8.0

func (r *Rendering) PlantUML() (string, error)

PlantUML is the PlantUML form of a rendering: a class diagram of a tree, a nested rectangle diagram of an interconnection, a state diagram of a state or action rendering, and a sequence diagram of a sequence, in the Standard B&W style with its rules written into the file. What the rendering could not represent is written as `'` comments, so no notice is lost.

func (*Rendering) PlantUMLWith added in v0.8.0

func (r *Rendering) PlantUMLWith(options Options) (string, error)

PlantUMLWith is the PlantUML form written with options: drawn in the stated direction (PlantUML draws top to bottom or left to right, so a reversed direction takes its nearest and is noted as not represented; the empty direction leaves PlantUML's default) and filled from the stated palette by keyword family, as the DOT form is. Placement is written as comments, PlantUML having no absolute positions; for pinned positions use the DOT form.

func (*Rendering) Text

func (r *Rendering) Text() string

Text is the human-readable form of a rendering, written to no particular width. It is ASCII throughout, so it reads the same on any terminal; a positioned node ends in `at (x, y)` and, when sized, `size W×H`.

func (*Rendering) TextWidth added in v0.1.1

func (r *Rendering) TextWidth(width int) string

TextWidth is the human-readable form of a rendering: a header saying what was rendered and how, the nodes as an indented tree, the edges beneath it, and what the rendering could not represent. It is what the REPL prints. A table's columns are written to fit width, wrapping their cells; WidthUnbounded writes each column as wide as its widest cell.

func (*Rendering) Write

func (r *Rendering) Write(form Form) (string, error)

Write is the rendering in form, with the default options: no particular width, each kind's direction, black and white.

func (*Rendering) WriteWith added in v0.8.0

func (r *Rendering) WriteWith(form Form, options Options) (string, error)

WriteWith is the rendering in form, written with options. A form the kind is not written in is a *WrongFormError, and an unknown form names the ones there are.

type RowData added in v0.1.2

type RowData struct {
	Cells  []string
	Origin Origin
}

RowData is one row of a tabular rendering: its cells, one per column, and where the element it reports was declared.

type SourceText

type SourceText = source.Lookup

SourceText answers the notation a span of a document was written in, so that a label a rendering takes verbatim — a transition guard, a trigger expression — reads as it was written. It may be nil, and returns "" for a document it does not hold, in which case such a label is described structurally instead.

type UnknownPaletteError added in v0.8.0

type UnknownPaletteError struct {
	Name string
}

UnknownPaletteError is a palette asked for by a name no palette has; it names the palettes there are, so no surface refuses one without saying which.

func (*UnknownPaletteError) Error added in v0.8.0

func (e *UnknownPaletteError) Error() string

func (*UnknownPaletteError) Unwrap added in v0.8.0

func (e *UnknownPaletteError) Unwrap() error

type UnsupportedKindError

type UnsupportedKindError struct {
	// Kind is the rendering kind asked for.
	Kind Kind
	// View is the view stating it, by qualified name.
	View string
	// Stated is what the model says the kind through — a rendering member, or
	// the standard view definition the view specializes.
	Stated string
	// Remedy is what to do instead, empty when there is nothing to suggest.
	Remedy string
}

UnsupportedKindError is a view stating a rendering kind that is recognized but not produced. It names both the kind and the view, and never falls back to another kind.

func (*UnsupportedKindError) Error

func (e *UnsupportedKindError) Error() string

func (*UnsupportedKindError) Unwrap

func (e *UnsupportedKindError) Unwrap() error

type WrongFormError

type WrongFormError struct {
	// Form is the form asked for, Kind the rendering's kind, and View the view
	// rendered, by qualified name.
	Form Form
	Kind Kind
	View string
}

WrongFormError is a form asked for that does not fit the rendering's kind: a Mermaid diagram of a table, a Markdown table of a diagram, or DOT of a sequence. It names the forms the kind is written in instead, and never writes another form silently.

func (*WrongFormError) Error

func (e *WrongFormError) Error() string

func (*WrongFormError) Unwrap

func (e *WrongFormError) Unwrap() error

Jump to

Keyboard shortcuts

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