Skip to content

Latest commit

 

History

History

html-template

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Example: Generating HTML output

The template file needs to follow go's html/template rules. A sample file is located here.

ecsv provides the output data represented via the struct HTMLData:

type HTMLDataRow struct {
	Data   []string
	InSync bool
}
type HTMLData struct {
	Title     string
	Columns   []string
	Rows      []HTMLDataRow
	Errors    *[]error
	Timestamp string
}

You will primarily be interested in iterating over the field Rows. HTMLDataRow.InSync signifies whether the versions for a system are in sync or not, and you can leverage that to render a row in a particular style.

The provided example file generates an HTML file that looks like the following:

HTML output