slugify

package module
v0.0.0-...-e2c1044 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2018 License: MIT Imports: 5 Imported by: 0

README

slugify

A Turkish/unicode compatible Slug generator library for golang.

Documentation

Overview

Package slugify is a Turkish/unicode compatible Slug generator library for golang.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Slugify

func Slugify(str string) (result string, err error)

Slugify converts given string into unicode compatible slug with standart Turkish configuration

Example
slugified, _ := Slugify("Şok! Silivri ve Sason ilçe jandarma komutanları 'FETÖ'den tutuklandı")
fmt.Println(slugified)
Output:

sok-silivri-ve-sason-ilce-jandarma-komutanlari-fetoden-tutuklandi

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API structs creates a wrapper to be used for custom configurations

func GetWithCustomReplacer

func GetWithCustomReplacer(replacer []string) *API

GetWithCustomReplacer returns API instance with given configuration

Example
slugified, _ := GetWithCustomReplacer([]string{
	" ", "-",
	"'", "",
	"ı", "i",
	",", "",
	".", "",
}).Slugify("5 simple tips and tricks for writing unit tests in #golang")
fmt.Println(slugified)
Output:

5-simple-tips-and-tricks-for-writing-unit-tests-in-#golang

func (*API) SetReplaceSet

func (api *API) SetReplaceSet(userReplaceSet []string)

SetReplaceSet changes default replace table with given table.

func (*API) Slugify

func (api *API) Slugify(str string) (result string, err error)

Slugify converts given string into unicode compatible slug with given configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL