From 81e3cdda44a2aed1ad0805fa738429c891b6209d Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 3 Nov 2025 13:55:04 +0100 Subject: [chore] update dependencies (#4539) - github.com/KimMachineGun/automemlimit: v0.7.4 -> v0.7.5 - github.com/tdewolff/minify/v2: v2.24.4 -> v2.24.5 - modernc.org/sqlite: v1.39.1 -> v1.40.0 w/ concurrency workaround - github.com/go-swagger/go-swagger: v0.32.3 -> v0.33.1 (and drops use of our custom fork now the fix is available upstream) Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4539 Co-authored-by: kim Co-committed-by: kim --- vendor/github.com/go-openapi/inflect/inflect.go | 100 ++++++++++++------------ 1 file changed, 51 insertions(+), 49 deletions(-) (limited to 'vendor/github.com/go-openapi/inflect/inflect.go') diff --git a/vendor/github.com/go-openapi/inflect/inflect.go b/vendor/github.com/go-openapi/inflect/inflect.go index 9d8ca6dbd..2a421c06b 100644 --- a/vendor/github.com/go-openapi/inflect/inflect.go +++ b/vendor/github.com/go-openapi/inflect/inflect.go @@ -307,15 +307,6 @@ func (rs *Ruleset) AddUncountable(word string) { rs.uncountables[strings.ToLower(word)] = true } -func (rs *Ruleset) isUncountable(word string) bool { - // handle multiple words by using the last one - words := strings.Split(word, " ") - if _, exists := rs.uncountables[strings.ToLower(words[len(words)-1])]; exists { - return true - } - return false -} - // returns the plural form of a singular word func (rs *Ruleset) Pluralize(word string) string { if len(word) == 0 { @@ -383,20 +374,6 @@ func (rs *Ruleset) Titleize(word string) string { return strings.Join(words, " ") } -func (rs *Ruleset) safeCaseAcronyms(word string) string { - // convert an acroymn like HTML into Html - for _, rule := range rs.acronyms { - word = strings.ReplaceAll(word, rule.suffix, rule.replacement) - } - return word -} - -func (rs *Ruleset) seperatedWords(word, sep string) string { - word = rs.safeCaseAcronyms(word) - words := splitAtCaseChange(word) - return strings.Join(words, sep) -} - // lowercase underscore version "BigBen" -> "big_ben" func (rs *Ruleset) Underscore(word string) string { return rs.seperatedWords(word, "_") @@ -452,32 +429,6 @@ func (rs *Ruleset) ParameterizeJoin(word, sep string) string { return word } -var lookalikes = map[string]*regexp.Regexp{ - "A": regexp.MustCompile(`À|Á|Â|Ã|Ä|Å`), - "AE": regexp.MustCompile(`Æ`), - "C": regexp.MustCompile(`Ç`), - "E": regexp.MustCompile(`È|É|Ê|Ë`), - "G": regexp.MustCompile(`Ğ`), - "I": regexp.MustCompile(`Ì|Í|Î|Ï|İ`), - "N": regexp.MustCompile(`Ñ`), - "O": regexp.MustCompile(`Ò|Ó|Ô|Õ|Ö|Ø`), - "S": regexp.MustCompile(`Ş`), - "U": regexp.MustCompile(`Ù|Ú|Û|Ü`), - "Y": regexp.MustCompile(`Ý`), - "ss": regexp.MustCompile(`ß`), - "a": regexp.MustCompile(`à|á|â|ã|ä|å`), - "ae": regexp.MustCompile(`æ`), - "c": regexp.MustCompile(`ç`), - "e": regexp.MustCompile(`è|é|ê|ë`), - "g": regexp.MustCompile(`ğ`), - "i": regexp.MustCompile(`ì|í|î|ï|ı`), - "n": regexp.MustCompile(`ñ`), - "o": regexp.MustCompile(`ò|ó|ô|õ|ö|ø`), - "s": regexp.MustCompile(`ş`), - "u": regexp.MustCompile(`ù|ú|û|ü|ũ|ū|ŭ|ů|ű|ų`), - "y": regexp.MustCompile(`ý|ÿ`), -} - // transforms latin characters like é -> e func (rs *Ruleset) Asciify(word string) string { for repl, regex := range lookalikes { @@ -500,6 +451,8 @@ func (rs *Ruleset) Dasherize(word string) string { } // "1031" -> "1031st" +// +//nolint:mnd func (rs *Ruleset) Ordinalize(str string) string { number, err := strconv.Atoi(str) if err != nil { @@ -521,6 +474,55 @@ func (rs *Ruleset) Ordinalize(str string) string { return fmt.Sprintf("%dth", number) } +func (rs *Ruleset) isUncountable(word string) bool { + // handle multiple words by using the last one + words := strings.Split(word, " ") + if _, exists := rs.uncountables[strings.ToLower(words[len(words)-1])]; exists { + return true + } + return false +} + +func (rs *Ruleset) safeCaseAcronyms(word string) string { + // convert an acroymn like HTML into Html + for _, rule := range rs.acronyms { + word = strings.ReplaceAll(word, rule.suffix, rule.replacement) + } + return word +} + +func (rs *Ruleset) seperatedWords(word, sep string) string { + word = rs.safeCaseAcronyms(word) + words := splitAtCaseChange(word) + return strings.Join(words, sep) +} + +var lookalikes = map[string]*regexp.Regexp{ + "A": regexp.MustCompile(`À|Á|Â|Ã|Ä|Å`), + "AE": regexp.MustCompile(`Æ`), + "C": regexp.MustCompile(`Ç`), + "E": regexp.MustCompile(`È|É|Ê|Ë`), + "G": regexp.MustCompile(`Ğ`), + "I": regexp.MustCompile(`Ì|Í|Î|Ï|İ`), + "N": regexp.MustCompile(`Ñ`), + "O": regexp.MustCompile(`Ò|Ó|Ô|Õ|Ö|Ø`), + "S": regexp.MustCompile(`Ş`), + "U": regexp.MustCompile(`Ù|Ú|Û|Ü`), + "Y": regexp.MustCompile(`Ý`), + "ss": regexp.MustCompile(`ß`), + "a": regexp.MustCompile(`à|á|â|ã|ä|å`), + "ae": regexp.MustCompile(`æ`), + "c": regexp.MustCompile(`ç`), + "e": regexp.MustCompile(`è|é|ê|ë`), + "g": regexp.MustCompile(`ğ`), + "i": regexp.MustCompile(`ì|í|î|ï|ı`), + "n": regexp.MustCompile(`ñ`), + "o": regexp.MustCompile(`ò|ó|ô|õ|ö|ø`), + "s": regexp.MustCompile(`ş`), + "u": regexp.MustCompile(`ù|ú|û|ü|ũ|ū|ŭ|ů|ű|ų`), + "y": regexp.MustCompile(`ý|ÿ`), +} + ///////////////////////////////////////// // the default global ruleset ////////////////////////////////////////// -- cgit v1.2.3