cyoa

package
v0.0.0-...-456044c Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 7 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

NewHandler instantiates new cyoa handler struct

Types

type HandlerOption

type HandlerOption func(h *handler)

HandlerOption is a func of handler options

func WithPathFunc

func WithPathFunc(fn func(r *http.Request) string) HandlerOption

WithPathFunc HandlerOptions option

func WithTemplate

func WithTemplate(t *template.Template) HandlerOption

WithTemplate HandlerOptions option

type Option

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

Option for the selection of different adventures

type Story

type Story map[string]*StoryArc

Story is a map to all StoryArcs

func JSONStory

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

JSONStory runs a choose your own adventure story

type StoryArc

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

StoryArc describes a chapter of the story

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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