mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-21 12:00:40 +00:00
parent
19bf65fbb3
commit
79df6b030f
@ -33,7 +33,8 @@ type OutputFormatterImpl struct {
|
|||||||
// NewOutputFormatter TemplateProcessor constructor.
|
// NewOutputFormatter TemplateProcessor constructor.
|
||||||
func NewOutputFormatter(templatesFS fs.FS) *OutputFormatterImpl {
|
func NewOutputFormatter(templatesFS fs.FS) *OutputFormatterImpl {
|
||||||
templateFNs := map[string]interface{}{
|
templateFNs := map[string]interface{}{
|
||||||
"timefmt": timeFormat,
|
"timefmt": timeFormat,
|
||||||
|
"getSection": getSection,
|
||||||
}
|
}
|
||||||
tpls := template.Must(template.New("templates").Funcs(templateFNs).ParseFS(templatesFS, "*"))
|
tpls := template.Must(template.New("templates").Funcs(templateFNs).ParseFS(templatesFS, "*"))
|
||||||
return &OutputFormatterImpl{templates: tpls}
|
return &OutputFormatterImpl{templates: tpls}
|
||||||
@ -94,3 +95,12 @@ func timeFormat(t time.Time, format string) string {
|
|||||||
}
|
}
|
||||||
return t.Format(format)
|
return t.Format(format)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getSection(sections []ReleaseNoteSection, name string) ReleaseNoteSection {
|
||||||
|
for _, section := range sections {
|
||||||
|
if section.SectionName() == name {
|
||||||
|
return section
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user