Remove "normalization" of non-Latin characters in tags
This commit is contained in:
parent
bb1a5bb877
commit
62bce6902e
|
@ -12,9 +12,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
||||||
// This replaces all special characters
|
|
||||||
tagRegexp = regexp.MustCompile(`[^a-z0-9\-\s]`)
|
|
||||||
tagRegexpSpaces = regexp.MustCompile(`[\s]+`)
|
tagRegexpSpaces = regexp.MustCompile(`[\s]+`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,13 +60,11 @@ func pqErrMsg(err error) string {
|
||||||
func normalizeTags(tags []string) []string {
|
func normalizeTags(tags []string) []string {
|
||||||
var (
|
var (
|
||||||
out []string
|
out []string
|
||||||
space = []byte(" ")
|
|
||||||
dash = []byte("-")
|
dash = []byte("-")
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, t := range tags {
|
for _, t := range tags {
|
||||||
rep := bytes.TrimSpace(tagRegexp.ReplaceAll(bytes.ToLower([]byte(t)), space))
|
rep := tagRegexpSpaces.ReplaceAll(bytes.TrimSpace([]byte(t)), dash)
|
||||||
rep = tagRegexpSpaces.ReplaceAll(rep, dash)
|
|
||||||
|
|
||||||
if len(rep) > 0 {
|
if len(rep) > 0 {
|
||||||
out = append(out, string(rep))
|
out = append(out, string(rep))
|
||||||
|
|
Loading…
Reference in New Issue