blockdiag

package module
v0.0.0-...-b54831a Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2017 License: MIT Imports: 11 Imported by: 0

README

goblockdiag

Source original: https://bitbucket.org/blockdiag/blockdiag/src/07f96892bfda?at=default

Documentation original: http://blockdiag.com/en/index.html

Todo

  • Map Nodes on raster
  • Find start Node
  • Make last ; optional
  • Add attributes
    • Diagramm
    • Nodes
    • Edges
  • Node Groups
  • Strings in Quotes
  • Diagram name
  • Allow "diagram" and "blockdiag" as type
  • Check with gometalinter
  • Check with go cover
  • Use type grid *[][]*Node?
  • Tests for text output
  • Support long block names in text output
  • Code cleanup
  • Refactoring, if placeing part of edge, save what directions are already covered and add only new endpoints, decide the char in a later step
  • Self reference A -> A
  • Circular A -> B -> A
  • Refactoring API, only make neccessary functions, methods, types, etc. public
  • Split blockdiag into multiple files
  • Split blockdiag_test into multiple files
  • Add tests for getChildNodes and getParentNodes
  • Test implementation of PlaceInGrid with Breadth First
  • Self reference
A -> A;

 ▼──┐
[A]─┘
  • Circular
	blockdiag {
			A -> B -> C;
			B -> D -> E -> H;
			A -> F -> E;
			F -> G -> H;
			H -> A;
		}
  • Go up, until on the right height, right below End

  • Fix paint error, X and G seem connected but they aren't

`blockdiag {
	A -> B -> D;
	A -> X -> B;
	X -> D;
	X -> R;
	D -> G;
	D -> H;
	X -> H;
}`
  • Complete Failure

blockdiag { A -> B; A -> F; # Zwei mal A -> F A -> F; G -> A; G -> B; }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGrid

func NewGrid() grid

func NewSizedGrid

func NewSizedGrid(x, y int) grid

func Parse

func Parse(filename string, b []byte, opts ...Option) (interface{}, error)

Parse parses the data from b using filename as information in the error messages.

func ParseFile

func ParseFile(filename string, opts ...Option) (interface{}, error)

ParseFile parses the file identified by filename.

func ParseReader

func ParseReader(filename string, r io.Reader, opts ...Option) (interface{}, error)

ParseReader parses the data from r using filename as information in the error messages.

Types

type Diag

type Diag struct {
	Name       string
	Nodes      map[string]*Node
	Edges      map[string]*Edge
	Attributes map[string]string
	Circular   []*nodes
	Grid       grid
}

func NewDiag

func NewDiag() Diag

func (*Diag) AttributesString

func (diag *Diag) AttributesString() string

func (*Diag) CircularString

func (diag *Diag) CircularString() string

func (*Diag) EdgesString

func (diag *Diag) EdgesString() string

func (*Diag) FindCircular

func (diag *Diag) FindCircular() bool

func (*Diag) GoString

func (diag *Diag) GoString() string

func (*Diag) GridString

func (diag *Diag) GridString() string

func (*Diag) NodesString

func (diag *Diag) NodesString() string

func (*Diag) PlaceInGrid

func (diag *Diag) PlaceInGrid()

func (*Diag) String

func (diag *Diag) String() string

type Edge

type Edge struct {
	Start *Node
	End   *Node
	Name  string
	// contains filtered or unexported fields
}

type Edges

type Edges []*Edge

func (Edges) Len

func (edges Edges) Len() int

func (Edges) Less

func (edges Edges) Less(i, j int) bool

func (Edges) String

func (edges Edges) String() string

func (Edges) Swap

func (edges Edges) Swap(i, j int)

type Node

type Node struct {
	Name       string
	PosX       int
	PosY       int
	Edges      []*Edge
	Attributes map[string]string
}

type Nodes

type Nodes []*Node

func (Nodes) Len

func (nodes Nodes) Len() int

func (Nodes) Less

func (nodes Nodes) Less(i, j int) bool

func (Nodes) String

func (nodes Nodes) String() string

func (Nodes) Swap

func (nodes Nodes) Swap(i, j int)

type Option

type Option func(*parser) Option

Option is a function that can set an option on the parser. It returns the previous setting as an Option.

func Debug

func Debug(b bool) Option

Debug creates an Option to set the debug flag to b. When set to true, debugging information is printed to stdout while parsing.

The default is false.

func Memoize

func Memoize(b bool) Option

Memoize creates an Option to set the memoize flag to b. When set to true, the parser will cache all results so each expression is evaluated only once. This guarantees linear parsing time even for pathological cases, at the expense of more memory and slower times for typical cases.

The default is false.

func Recover

func Recover(b bool) Option

Recover creates an Option to set the recover flag to b. When set to true, this causes the parser to recover from panics and convert it to an error. Setting it to false can be useful while debugging to access the full stack trace.

The default is true.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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