feat: better PDF

This commit is contained in:
2025-08-24 00:24:40 +02:00
parent 0267e6e578
commit 5b664234e9
18 changed files with 540 additions and 228 deletions

View File

@@ -1,6 +1,9 @@
package issue
import (
"fmt"
"regexp"
"strings"
"time"
"code.gitea.io/sdk/gitea"
@@ -10,3 +13,23 @@ type Issue struct {
gitea.Issue
Duration time.Duration
}
func (i Issue) Shorthand() string {
str := i.Repository.Name
if strings.Contains(str, "-") {
s := strings.Split(str, "-")
str = s[len(s)-1]
} else if len(str) > 3 {
str = str[:3]
}
return fmt.Sprintf("%s-%d", strings.ToUpper(str), i.Index)
}
func (i Issue) CleanBody() string {
reBlock := regexp.MustCompile("(?s)```info(.*?)```(.*)")
block := reBlock.FindStringSubmatch(i.Body)
if len(block) < 3 {
return i.Body
}
return strings.TrimSpace(block[2])
}