slug

package
v0.0.0-...-1fbbad1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2016 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright 2013 by Dobrosław Żybort. All rights reserved. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Index

Constants

This section is empty.

Variables

View Source
var (

	// Custom substitution map
	CustomSub map[string]string
	// Custom rune substitution map
	CustomRuneSub map[rune]string

	// Maximum slug length. It's smart so it will cat slug after full word.
	// By default slugs aren't shortened.
	// If MaxLength is smaller than length of the first word, then returned
	// slug will contain only substring from the first word truncated
	// after MaxLength.
	MaxLength int
)

Functions

func Make

func Make(s string) (slug string)

Make returns slug generated from provided string. Will use "en" as language substitution.

func MakeLang

func MakeLang(s string, lang string) (slug string)

MakeLang returns slug generated from provided string and will use provided language for chars substitution.

func Substitute

func Substitute(s string, sub map[string]string) (buf string)

Substitute returns string with superseded all substrings from provided substitution map.

func SubstituteRune

func SubstituteRune(s string, sub map[rune]string) (buf string)

SubstituteRune substitutes string chars with provided rune substitution map.

Types

This section is empty.

Jump to

Keyboard shortcuts

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