Documentation
¶
Overview ¶
Package render provides diagram renderers for PIDL protocols.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DOTRenderer ¶
type DOTRenderer struct {
// Title includes the protocol name as graph label.
Title bool
// RankDir sets the graph direction (LR, TB, RL, BT).
RankDir string
// MergeEdges combines multiple flows between the same entities.
MergeEdges bool
// ShowPhases groups nodes by phase using subgraphs.
ShowPhases bool
}
DOTRenderer renders PIDL protocols as Graphviz DOT data flow diagrams.
func (*DOTRenderer) Format ¶
func (r *DOTRenderer) Format() Format
Format returns the output format.
func (*DOTRenderer) RenderString ¶
func (r *DOTRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the DOT diagram as a string.
type Format ¶
type Format string
Format represents a diagram output format.
func MustParseFormat ¶
MustParseFormat parses a format string, panicking on error.
func ParseFormat ¶
ParseFormat parses a format string, returning an error if invalid.
func SupportedFormats ¶
func SupportedFormats() []Format
SupportedFormats returns all supported output formats.
func (Format) FileExtension ¶
FileExtension returns the conventional file extension for this format.
type MermaidRenderer ¶
type MermaidRenderer struct {
// Title includes the protocol name as diagram title.
Title bool
// Autonumber adds sequence numbers to messages.
Autonumber bool
}
MermaidRenderer renders PIDL protocols as Mermaid sequence diagrams.
func NewMermaid ¶
func NewMermaid() *MermaidRenderer
NewMermaid creates a new Mermaid renderer with default options.
func (*MermaidRenderer) Format ¶
func (r *MermaidRenderer) Format() Format
Format returns the output format.
func (*MermaidRenderer) RenderString ¶
func (r *MermaidRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the Mermaid diagram as a string.
type PlantUMLRenderer ¶
type PlantUMLRenderer struct {
// Title includes the protocol name as diagram title.
Title bool
// ShowDescriptions includes flow descriptions as notes.
ShowDescriptions bool
}
PlantUMLRenderer renders PIDL protocols as PlantUML sequence diagrams.
func NewPlantUML ¶
func NewPlantUML() *PlantUMLRenderer
NewPlantUML creates a new PlantUML renderer with default options.
func (*PlantUMLRenderer) Format ¶
func (r *PlantUMLRenderer) Format() Format
Format returns the output format.
func (*PlantUMLRenderer) RenderString ¶
func (r *PlantUMLRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the PlantUML diagram as a string.
type Renderer ¶
type Renderer interface {
// Render writes the diagram to the writer.
Render(w io.Writer, p *pidl.Protocol) error
// RenderString returns the diagram as a string.
RenderString(p *pidl.Protocol) (string, error)
// Format returns the output format name.
Format() Format
}
Renderer generates diagram output from a Protocol.