doc.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. Package slug generate slug from unicode string, URL-friendly slugify with
  7. multiple languages support.
  8. Example:
  9. package main
  10. import(
  11. "github.com/gosimple/slug"
  12. "fmt"
  13. )
  14. func main () {
  15. text := slug.Make("Hellö Wörld хелло ворлд")
  16. fmt.Println(text) // Will print hello-world-khello-vorld
  17. someText := slug.Make("影師")
  18. fmt.Println(someText) // Will print: ying-shi
  19. enText := slug.MakeLang("This & that", "en")
  20. fmt.Println(enText) // Will print 'this-and-that'
  21. deText := slug.MakeLang("Diese & Dass", "de")
  22. fmt.Println(deText) // Will print 'diese-und-dass'
  23. slug.CustomSub = map[string]string{
  24. "water": "sand",
  25. }
  26. textSub := slug.Make("water is hot")
  27. fmt.Println(textSub) // Will print 'sand-is-hot'
  28. }
  29. Requests or bugs?
  30. https://github.com/gosimple/slug/issues
  31. */
  32. package slug