docs #4

Merged
mfocko merged 3 commits from docs into main 2021-09-11 23:57:55 +02:00
Showing only changes of commit 53deef6627 - Show all commits

View file

@ -18,11 +18,9 @@ func GetSeparatorForMultiline(config *Config) string {
func FormatComment(config *Config, body string, beenWrapped bool) string { func FormatComment(config *Config, body string, beenWrapped bool) string {
if beenWrapped && !config.Language.OpeningOnSeparateLine { if beenWrapped && !config.Language.OpeningOnSeparateLine {
body = " " + strings.TrimPrefix(body, " "+config.Language.Continuation) body = strings.TrimPrefix(body, config.Language.Continuation)
}
if !beenWrapped && !config.Language.OpeningOnSeparateLine && !strings.HasSuffix(body, "\n") {
body = body + "\n"
} }
body = strings.TrimRightFunc(body, unicode.IsSpace)
return fmt.Sprintf("%s%s%s", config.Language.Opening, body, config.Language.Closing) return fmt.Sprintf("%s%s%s", config.Language.Opening, body, config.Language.Closing)
} }
@ -32,8 +30,6 @@ func ProcessComment(config *Config, wrapper *wrap.Wrapper, comment *gitea.PullRe
beenWrapped := len(body)+len(config.Language.Opening)+len(config.Language.Closing) > 100 beenWrapped := len(body)+len(config.Language.Opening)+len(config.Language.Closing) > 100
if beenWrapped { if beenWrapped {
body = GetSeparatorForMultiline(config) + wrapper.Wrap(body, 100) body = GetSeparatorForMultiline(config) + wrapper.Wrap(body, 100)
} else {
body = " " + body
} }
body = strings.Replace(body, "\r", "", -1) body = strings.Replace(body, "\r", "", -1)