Add: ability to set custom substitution map
This commit is contained in:
parent
dba1820a69
commit
f8ad7d8035
6
slug.go
6
slug.go
@ -11,6 +11,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Custom substitution map
|
||||||
|
CustomSub map[rune]string
|
||||||
|
)
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
// Make returns slug generated from provided string. Will use "en" as language
|
// Make returns slug generated from provided string. Will use "en" as language
|
||||||
@ -37,6 +42,7 @@ func MakeLang(s string, lang string) (slug string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
slug = substitute(slug, defaultSub)
|
slug = substitute(slug, defaultSub)
|
||||||
|
slug = substitute(slug, CustomSub)
|
||||||
|
|
||||||
slug = unidecode.Unidecode(slug)
|
slug = unidecode.Unidecode(slug)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user