1// Copyright 2013 by Dobrosław Żybort. All rights reserved.
2// This Source Code Form is subject to the terms of the Mozilla Public
3// License, v. 2.0. If a copy of the MPL was not distributed with this
4// file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6/*
7Package slug generate slug from unicode string, URL-friendly slugify with
8multiple languages support.
9
10Example:
11
12 package main
13
14 import(
15 "github.com/gosimple/slug"
16 "fmt"
17 )
18
19 func main () {
20 text := slug.Make("Hellö Wörld хелло ворлд")
21 fmt.Println(text) // Will print: "hello-world-khello-vorld"
22
23 someText := slug.Make("影師")
24 fmt.Println(someText) // Will print: "ying-shi"
25
26 enText := slug.MakeLang("This & that", "en")
27 fmt.Println(enText) // Will print: "this-and-that"
28
29 deText := slug.MakeLang("Diese & Dass", "de")
30 fmt.Println(deText) // Will print: "diese-und-dass"
31
32 slug.Lowercase = false // Keep uppercase characters
33 deUppercaseText := slug.MakeLang("Diese & Dass", "de")
34 fmt.Println(deUppercaseText) // Will print: "Diese-und-Dass"
35
36 slug.CustomSub = map[string]string{
37 "water": "sand",
38 }
39 textSub := slug.Make("water is hot")
40 fmt.Println(textSub) // Will print: "sand-is-hot"
41 }
42
43Requests or bugs?
44
45https://github.com/gosimple/slug/issues
46*/
47package slug