in tools/go-changelog/note.go [44:84]
func NotesFromEntry(entry Entry) []Note {
var res []Note
for _, re := range textInBodyREs {
matches := re.FindAllStringSubmatch(entry.Body, -1)
if len(matches) == 0 {
continue
}
for _, match := range matches {
note := ""
typ := ""
for i, name := range re.SubexpNames() {
switch name {
case "note":
note = match[i]
case "type":
typ = match[i]
}
if note != "" && typ != "" {
break
}
}
typ = strings.TrimSpace(typ)
if note == "" && typ == "" {
continue
}
res = append(res, Note{
Type: typ,
Body: note,
Issue: entry.Issue,
Hash: entry.Hash,
Date: entry.Date,
})
}
}
sort.Slice(res, SortNotes(res))
return res
}