cyoa

package
v0.0.0-...-4606bbd Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(s Story, opts ...HandlerOption) http.Handler

Types

type Chapter

type Chapter struct {
	Title      string   `json:"title"`
	Paragraphs []string `json:"story"`
	Options    []Option `json:"options"`
}

type HandlerOption

type HandlerOption func(h *handler)

func WithPathFunc

func WithPathFunc(fn pathFunc) HandlerOption

func WithTemplate

func WithTemplate(t *template.Template) HandlerOption

type Option

type Option struct {
	Text string `json:"text"`
	Arc  string `json:"arc"`
}

type Story

type Story map[string]Chapter

func JsonStory

func JsonStory(r io.Reader) (Story, error)

Jump to

Keyboard shortcuts

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