zml

package module
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

README

ZML

CI GoDoc GoReportCard License

Diagram and flowchart tool written in Golang

Installation
$ go install github.com/jessp01/zml/cmd/zml_cli@latest
Example

See the examples dir for sample input files.

$ ./zml_cli --font-dir /usr/share/texlive/texmf-dist/fonts/truetype/google/roboto \
    --title-font "Roboto-Bold.ttf,37" \
    --label-font "Roboto-Italic.ttf,15" \
    --element-font "Roboto-Regular.ttf,21" \
    ./examples/sequence_flow1.zml

Will create ./examples/sequence_flow1.zml.png

example sequence flow

Documentation

Index

Constants

View Source
const (
	// RECT sets elemenet type to rectangle
	RECT int = 0
	// DECISION sets elemenet type to decision node
	DECISION = 1
	// CIRCLE sets elemenet type to circle
	CIRCLE = 2
)

Variables

This section is empty.

Functions

func Colorlookup

func Colorlookup(s string) (r int, g int, b int)

Colorlookup returns a RGB triple corresponding to the named color, "rgb(r,g,b)" or "#rrggbb" string. On error, return black.

Types

type Color

type Color struct {
	Red, Green, Blue int
}

Color is a RGB set of ints; for a nice picker see https://www.w3schools.com/colors/colors_picker.asp

type Diagram

type Diagram struct {
	// contains filtered or unexported fields
}

Diagram represents a diagram

func NewDiagram

func NewDiagram(filename string) *Diagram

NewDiagram init function

func (*Diagram) AddConnection

func (dia *Diagram) AddConnection(from, to string, label string) error

AddConnection adds a connection (renders as a line) between two elemenets

func (*Diagram) AddDirectionalConnection

func (dia *Diagram) AddDirectionalConnection(from, to string, label string) error

AddDirectionalConnection adds a connection (renders as an arrowed line) between two elemenets

func (*Diagram) AddElemenets

func (dia *Diagram) AddElemenets(name ...string)

AddElemenets sets the `elemenet` array on the Diagram object

func (*Diagram) ProcessData added in v0.21.3

func (dia *Diagram) ProcessData(data []byte)

ProcessData generates image from ZML data

func (*Diagram) Render

func (dia *Diagram) Render()

Render generates an image from a `Diagram` object

func (*Diagram) SetDebug

func (dia *Diagram) SetDebug(debug bool)

SetDebug set debug value

func (*Diagram) SetElementLabelFont

func (dia *Diagram) SetElementLabelFont(font Font)

SetElementLabelFont sets font to use for labels

func (*Diagram) SetFontDir

func (dia *Diagram) SetFontDir(dir string)

SetFontDir path to font dir

func (*Diagram) SetLabelFont

func (dia *Diagram) SetLabelFont(font Font)

SetLabelFont sets font to use for labels

func (*Diagram) SetTitle

func (dia *Diagram) SetTitle(title string)

SetTitle sets the diagram's title

func (*Diagram) SetTitleFont

func (dia *Diagram) SetTitleFont(font Font)

SetTitleFont sets font to use for the title

type Font

type Font struct {
	Name  string
	Size  float64
	Color Color
}

Font font settings

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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