Change: make substitute function public
This commit is contained in:
parent
f8ad7d8035
commit
4d153f396b
1 changed files with 7 additions and 7 deletions
14
slug.go
14
slug.go
|
|
@ -32,17 +32,17 @@ func MakeLang(s string, lang string) (slug string) {
|
|||
// Select substitution language
|
||||
switch lang {
|
||||
case "de":
|
||||
slug = substitute(slug, deSub)
|
||||
slug = Substitute(slug, deSub)
|
||||
case "en":
|
||||
slug = substitute(slug, enSub)
|
||||
slug = Substitute(slug, enSub)
|
||||
case "pl":
|
||||
slug = substitute(slug, plSub)
|
||||
slug = Substitute(slug, plSub)
|
||||
default: // fallback to "en" if lang not found
|
||||
slug = substitute(slug, enSub)
|
||||
slug = Substitute(slug, enSub)
|
||||
}
|
||||
|
||||
slug = substitute(slug, defaultSub)
|
||||
slug = substitute(slug, CustomSub)
|
||||
slug = Substitute(slug, defaultSub)
|
||||
slug = Substitute(slug, CustomSub)
|
||||
|
||||
slug = unidecode.Unidecode(slug)
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ func MakeLang(s string, lang string) (slug string) {
|
|||
}
|
||||
|
||||
// Substitute string chars with provided substitution map.
|
||||
func substitute(s string, sub map[rune]string) (buf string) {
|
||||
func Substitute(s string, sub map[rune]string) (buf string) {
|
||||
for _, c := range s {
|
||||
if d, ok := sub[c]; ok {
|
||||
buf += d
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue