readmegen

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(opts GenerateOptions) error

func Preprocess

func Preprocess(data string) (string, error)

Preprocess takes the contents of a readme file and preprocesses it by replacing readmegen tags with the corresponding Go templates. A readmegen tag is a HTML comment with the following format: <!-- readmegen:tag --> which has a corresponding end tag <!-- /readmegen:tag -->. Everything between the tags is replaced with the corresponding template. If the tag is not found, or a comment is not closed, an error is returned.

Types

type Command

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

func NewCommand

func NewCommand(specificationsFile, readmeFile string, write bool) *Command

func (*Command) Execute

func (cmd *Command) Execute(_ context.Context) error

type GenerateOptions

type GenerateOptions struct {
	// Required fields
	Data       any       // The data to use in template generation
	ReadmePath string    // Path to the readme template file
	Out        io.Writer // Where to write the generated output

	// Optional fields
	FuncMap     template.FuncMap // Custom function map to merge with default functions
	TemplatesFS fs.FS            // Custom templates directory to merge with default templates
}

Jump to

Keyboard shortcuts

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