Add: ability to set custom substitution map
This commit is contained in:
parent
dba1820a69
commit
f8ad7d8035
1 changed files with 6 additions and 0 deletions
6
slug.go
6
slug.go
|
|
@ -11,6 +11,11 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
// Custom substitution map
|
||||
CustomSub map[rune]string
|
||||
)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
// 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, CustomSub)
|
||||
|
||||
slug = unidecode.Unidecode(slug)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue