slug/README.md

53 lines
1.4 KiB
Markdown
Raw Normal View History

2013-03-13 15:14:21 +01:00
slug
====
2013-03-13 15:17:44 +01:00
Package `slug` generate slug from unicode string, URL-friendly slugify with
2013-03-13 15:14:21 +01:00
multiple languages support.
2014-03-05 20:57:24 +01:00
[![GoDoc](https://godoc.org/bitbucket.org/gosimple/slug?status.png)](https://godoc.org/bitbucket.org/gosimple/slug)
2014-03-05 21:14:32 +01:00
[![Build Status](https://drone.io/bitbucket.org/gosimple/slug/status.png)](https://drone.io/bitbucket.org/gosimple/slug/latest)
2013-03-13 15:14:21 +01:00
## Example
package main
2013-05-10 15:05:15 +02:00
2013-03-13 15:14:21 +01:00
import(
"bitbucket.org/gosimple/slug"
"fmt"
)
2013-05-10 15:05:15 +02:00
func main () {
text := slug.Make("Hellö Wörld хелло ворлд")
fmt.Println(text) // Will print hello-world-khello-vorld
someText := slug.Make("影師")
fmt.Println(someText) // Will print: ying-shi
enText := slug.MakeLang("This & that", "en")
fmt.Println(enText) // Will print 'this-and-that'
deText := slug.MakeLang("Diese & Dass", "de")
fmt.Println(deText) // Will print 'diese-und-dass'
2013-05-10 17:51:12 +02:00
slug.CustomSub = map[string]string{
"water": "sand",
}
textSub := slug.Make("water is hot")
fmt.Println(textSub) // Will print 'sand-is-hot'
2013-05-10 15:05:15 +02:00
}
### Requests or bugs?
2013-03-13 15:14:21 +01:00
<https://bitbucket.org/gosimple/slug/issues>
## Installation
go get -u bitbucket.org/gosimple/slug
## License
2013-05-10 15:05:15 +02:00
The source files are distributed under the
2013-03-13 15:14:21 +01:00
[Mozilla Public License, version 2.0](http://mozilla.org/MPL/2.0/),
2013-05-10 15:05:15 +02:00
unless otherwise noted.
2013-03-13 15:14:21 +01:00
Please read the [FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html)
if you have further questions regarding the license.