demo

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexOK        string = "ok"        // indexed title matched title of a demo
	IndexHidden           = "hidden"    // demo indexed but should not be displayed to end users (yet)
	IndexMissing          = "missing"   // title in index did not match the title of any demos
	IndexUnindexed        = "unindexed" // demo's title was not found in index
)

Variables

This section is empty.

Functions

func Archives

func Archives() []demoArchive

Archives returns all embedded demo (txtar) archives

Types

type Demo

type Demo struct {
	File        string              `json:"file"`              // name of the demo's original archive file
	IndexState  string              `json:"index"`             // "ok", "hidden", "missing" or "unindexed"
	Title       string              `json:"title"`             // name shown to users in front-end
	Subtitle    string              `json:"subtitle"`          // short clarification of the title
	Tags        []string            `json:"tags,omitempty"`    // set of terms relating to this demo
	Description string              `json:"description"`       // full description of what the demo is demonstrating (HTML)
	Input       string              `json:"input"`             // input text to be re-formatted
	Features    []string            `json:"show,omitempty"`    // which features to show in the UI
	Reset       bool                `json:"reset"`             // reset options when loading this demo
	Options     map[string]string   `json:"options,omitempty"` // optional values to be pre-set
	Data        map[string][]string `json:"data,omitempty"`    // optional set of values to provide for each options
}

structure sent to UI front end

Note:

  • all fields can be set via yaml in the -- demo -- section of a txtar archive
  • goccy/go-yaml uses json tags if yaml tags are missing

func ArchivedDemos

func ArchivedDemos() []*Demo

archivedDemos returns a list of Demo objects

type DemoIndex

type DemoIndex struct {
	Pos   int    // position in index, used for sorting
	Title string // title of demo as shown in psv-ui
	State string // see Index... constants above
}

Jump to

Keyboard shortcuts

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