in cqlprotodoc/main.go [82:99]
func formatBody(text []spec.Text, sectionNumbers map[string]struct{}) template.HTML {
var sb strings.Builder
for _, t := range text {
switch {
case t.SectionRef != "":
if _, ok := sectionNumbers[t.SectionRef]; ok {
link(&sb, "#s"+t.SectionRef, t.Text)
} else {
sb.WriteString(template.HTMLEscapeString(t.Text))
}
case t.Href != "":
link(&sb, t.Href, t.Text)
default:
sb.WriteString(template.HTMLEscapeString(t.Text))
}
}
return template.HTML(sb.String())
}