Refactor "string truncate" (#32984)

This commit is contained in:
wxiaoguang authored and GitHub committed 2024-12-26 11:56:03 +08:00
1 parent 594edad213
commit 9bfa9f450d
26 files changed
+199 -140

No files matched your search

+1 -1
View File
@@ -664,7 +664,7 @@ func PrepareCompareDiff(
}
if len(title) > 255 {
var trailer string
title, trailer = util.SplitStringAtByteN(title, 255)
title, trailer = util.EllipsisDisplayStringX(title, 255)
if len(trailer) > 0 {
if ctx.Data["content"] != nil {
ctx.Data["content"] = fmt.Sprintf("%s\n\n%s", trailer, ctx.Data["content"])