func ProcessPunctuation(mb *util.MarkupBuilder, dash string, quotes map[int]string, qp QuotesProvider, removeSpacesAroundDash bool) { qAlt := false for i := 0; i <= mb.LastCharIndex(); i++ { r := mb.RuneAt(i) switch r { case '"': var qType int if i < mb.LastCharIndex() && unicode.IsLetter(mb.RuneAt(i+1)) { if qAlt { qType = qp.OpenAlt() } else { qType = qp.Open() } } else { if !qAlt { qType = qp.CloseAlt() } else { qType = qp.Close() } } qAlt = !qAlt if qStr, ok := quotes[qType]; ok { mb.SubstituteStringAt(i, 1, qStr) } break case '-': if i < mb.LastCharIndex() && unicode.IsSpace(mb.RuneAt(i+1)) { if removeSpacesAroundDash { var left int if i > 0 { left = i - 1 } else { left = i } mb.SubstituteStringAt(left, 3, dash) } else { mb.SubstituteStringAt(i, 1, dash) } } break } } }