render

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package render converts SteerSpec entity files into human-readable formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format string

Format represents an output format.

const (
	FormatMarkdown Format = "markdown"
)

Supported output formats.

type MarkdownRenderer

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

MarkdownRenderer renders entity files to Markdown using Go templates.

func NewMarkdownRenderer

func NewMarkdownRenderer(opts ...Option) *MarkdownRenderer

NewMarkdownRenderer creates a new Markdown renderer with optional configuration.

func (*MarkdownRenderer) Render

func (r *MarkdownRenderer) Render(w io.Writer, ef *entity.File) error

Render writes the entity file as Markdown to w.

type Option

type Option func(*MarkdownRenderer)

Option configures a MarkdownRenderer.

func WithTemplate

func WithTemplate(path string) Option

WithTemplate overrides the built-in template with a custom template file.

type Renderer

type Renderer interface {
	Render(w io.Writer, ef *entity.File) error
}

Renderer converts an entity file to a specific output format.

func New

func New(format Format, opts ...Option) (Renderer, error)

New returns a Renderer for the given format.

type RuleIDFormatter

type RuleIDFormatter struct {
	OpenBracket      string
	CloseBracket     string
	RevisionSplitter string
	StateSplitter    string
}

RuleIDFormatter formats a rule's display identifier according to RLIFRMT rules.

func DefaultRuleIDFormatter

func DefaultRuleIDFormatter() RuleIDFormatter

DefaultRuleIDFormatter returns a formatter with RLIFRMT default settings.

func (RuleIDFormatter) Format

func (f RuleIDFormatter) Format(r *entity.Rule) string

Format returns the rendered rule identifier, e.g. "ENT-001.0/D".

Jump to

Keyboard shortcuts

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