Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.gitignore | H A D | 22-Oct-2019 | 16 | 3 | 2 | |
.travis.yml | H A D | 22-Oct-2019 | 378 | 21 | 18 | |
LICENSE | H A D | 22-Oct-2019 | 16.3 KiB | 374 | 293 | |
README.md | H A D | 22-Oct-2019 | 1.6 KiB | 63 | 45 | |
doc.go | H A D | 22-Oct-2019 | 1.2 KiB | 48 | 1 | |
go.mod | H A D | 22-Oct-2019 | 116 | 6 | 3 | |
go.sum | H A D | 22-Oct-2019 | 235 | 3 | 2 | |
languages_substitution.go | H A D | 22-Oct-2019 | 1.8 KiB | 121 | 100 | |
slug.go | H A D | 22-Oct-2019 | 4.7 KiB | 175 | 114 | |
slug_test.go | H A D | 22-Oct-2019 | 15.9 KiB | 468 | 418 |
README.md
1slug 2==== 3 4Package `slug` generate slug from unicode string, URL-friendly slugify with 5multiple languages support. 6 7[![GoDoc](https://godoc.org/github.com/gosimple/slug?status.png)](https://godoc.org/github.com/gosimple/slug) 8[![Build Status](https://travis-ci.com/gosimple/slug.svg?branch=master)](https://travis-ci.com/gosimple/slug) 9 10[Documentation online](http://godoc.org/github.com/gosimple/slug) 11 12## Example 13 14```go 15package main 16 17import ( 18 "fmt" 19 "github.com/gosimple/slug" 20) 21 22func main() { 23 text := slug.Make("Hellö Wörld хелло ворлд") 24 fmt.Println(text) // Will print: "hello-world-khello-vorld" 25 26 someText := slug.Make("影師") 27 fmt.Println(someText) // Will print: "ying-shi" 28 29 enText := slug.MakeLang("This & that", "en") 30 fmt.Println(enText) // Will print: "this-and-that" 31 32 deText := slug.MakeLang("Diese & Dass", "de") 33 fmt.Println(deText) // Will print: "diese-und-dass" 34 35 slug.Lowercase = false // Keep uppercase characters 36 deUppercaseText := slug.MakeLang("Diese & Dass", "de") 37 fmt.Println(deUppercaseText) // Will print: "Diese-und-Dass" 38 39 slug.CustomSub = map[string]string{ 40 "water": "sand", 41 } 42 textSub := slug.Make("water is hot") 43 fmt.Println(textSub) // Will print: "sand-is-hot" 44} 45 46``` 47 48### Requests or bugs? 49<https://github.com/gosimple/slug/issues> 50 51## Installation 52```sh 53go get -u github.com/gosimple/slug 54``` 55 56## License 57 58The source files are distributed under the 59[Mozilla Public License, version 2.0](http://mozilla.org/MPL/2.0/), 60unless otherwise noted. 61Please read the [FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html) 62if you have further questions regarding the license. 63