Documentation ¶
Overview ¶
Package tools includes miscellaneous tooling.
Index ¶
- func Dot(spec *Spec, w io.WriteCloser, fromNode, toNode string) error
- func Inline(bs []byte, f func(string) ([]byte, error)) ([]byte, error)
- func Mermaid(spec *Spec, w io.WriteCloser, opts *MermaidOpts, fromNode, toNode string) error
- func PNG(spec *Spec, basename string, fromNode, toNode string) (string, error)
- func ReadAllWithInlines(in io.Reader, dir string) ([]byte, error)
- func ReadAndRenderSpecPage(filename string, cssFiles []string, out io.Writer, includeGraph bool) error
- func ReadFileWithInlines(filename string) ([]byte, error)
- func RenderSpecHTML(s *core.Spec, out io.Writer) error
- func RenderSpecPage(s *core.Spec, out io.Writer, cssFiles []string, includeGraph bool) error
- type MermaidOpts
- type SpecAnalysis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dot ¶
func Dot(spec *Spec, w io.WriteCloser, fromNode, toNode string) error
Dot makes a Graphviz dot file for the given machine. A really ugly dot file.
The optional fromNode and toNode can be names of nodes during a transition. If non-zero, then the fromNode will be black and the toNode will be red. Maybe.
func Mermaid ¶
func Mermaid(spec *Spec, w io.WriteCloser, opts *MermaidOpts, fromNode, toNode string) error
Mermaid makes a Mermaid (https://mermaidjs.github.io/) input file for the given graph.
func PNG ¶
PNG generates a PNG image based on output from Dot.
This function with write two files: basename.dot and basename.png, where the basename is the given string.
func ReadAllWithInlines ¶
ReadFileWithInlines is a replacement for ioutil.ReadAll that adds automation Inline()ing based on the given directory.
'%inline("NAME")' is replaced with ReadFile(NAME).
func ReadAndRenderSpecPage ¶
func ReadFileWithInlines ¶
ReadFileWithInlines is a replacement for ioutil.ReadFile that adds automation Inline()ing based on the directory obtained from the filename.
'%inline("NAME")' is replaced with ReadFile(NAME).
Types ¶
type MermaidOpts ¶
type MermaidOpts struct { // ShowPatterns will result in a branch label that's theJSON // representation of the branch pattern (if any). ShowPatterns bool `json:"showPatterns"` // ActionFill is the fill color of for action nodes. Does not // apply if ActionClass is set. ActionFill string `json:"actionFill,omitempty"` // ActionClass will be the CSS class for action nodes. Not // yet implemented. ActionClass string `json:"actionClass,omitempty"` PrettyPatterns bool `json:"prettyPatterns,omitempty"` }