docs #4
1 changed files with 3 additions and 7 deletions
|
@ -13,16 +13,14 @@ func GetSeparatorForMultiline(config *Config) string {
|
||||||
if config.Language.OpeningOnSeparateLine {
|
if config.Language.OpeningOnSeparateLine {
|
||||||
return "\n"
|
return "\n"
|
||||||
}
|
}
|
||||||
return " "
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue