mirror of
https://github.com/miniflux/v2.git
synced 2025-08-31 18:31:01 +00:00
refactor(rewriter): use custom title case converter implementation instead of golang.org/x/text/cases.Title()
The implementation is equivalent to `cases.Title(language.English).String(strings.ToLower(…))`, and this is the only place in miniflux where "golang.org/x/text/cases" and "golang.org/x/text/language" are (directly) used. This reduces the binary size from 27015590 to 26686112 on my machine. Kudos to https://gsa.zxilly.dev for making it straightforward to catch things like this.
This commit is contained in:
parent
f52411f734
commit
195b75d185
3 changed files with 21 additions and 5 deletions
|
@ -11,9 +11,6 @@ import (
|
|||
|
||||
"miniflux.app/v2/internal/model"
|
||||
"miniflux.app/v2/internal/urllib"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
type rule struct {
|
||||
|
@ -94,7 +91,7 @@ func (rule rule) applyRule(entryURL string, entry *model.Entry) {
|
|||
case "remove_tables":
|
||||
entry.Content = removeTables(entry.Content)
|
||||
case "remove_clickbait":
|
||||
entry.Title = cases.Title(language.English).String(strings.ToLower(entry.Title))
|
||||
entry.Title = titlelize(entry.Title)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue