refactor(changelog): split get version header

main
hau 2020-11-29 19:21:02 +07:00
parent e643400357
commit 694261892c
1 changed files with 6 additions and 3 deletions

View File

@ -45,9 +45,7 @@ func (g *MarkdownGenerator) Generate(commits []convention.Commit) string {
nodes = append(nodes, markdown.NewHeader(firstLevel, title))
// version
year, month, day := g.t.Date()
versionHeader := fmt.Sprintf("%s (%d-%d-%d)", g.version, year, month, day)
nodes = append(nodes, markdown.NewHeader(secondLevel, versionHeader))
nodes = append(nodes, markdown.NewHeader(secondLevel, g.getVersionHeader()))
// new
nodes = append(nodes, newBases...)
@ -121,3 +119,8 @@ func (g *MarkdownGenerator) getOldNodes() []markdown.Node {
return result
}
func (g *MarkdownGenerator) getVersionHeader() string {
year, month, day := g.t.Date()
return fmt.Sprintf("%s (%d-%d-%d)", g.version, year, month, day)
}