slug

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2016 License: BSD-3-Clause, MIT Imports: 4 Imported by: 0

README

slug

See the API docs.

Latin-ish inputs should have very stable output. All inputs are passed through an NFKD transform, and anything still in the unicode Letter and Number categories are passed through intact. Anything in the Mark or Lm/Sk categories (modifiers) are skipped, and runs of characters from any other categories are collapsed to a single hyphen.

Documentation

Overview

Package slug transforms strings into a normalized form well suited for use in URLs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSlugAscii

func IsSlugAscii(s string) bool

IsSlugAscii returns true only if SlugAscii(s) == s.

func Slug

func Slug(s string) string

Slug replaces each run of characters which are not unicode letters or numbers with a single hyphen, except for leading or trailing runs. Letters will be stripped of diacritical marks and lowercased. Letter or number codepoints that do not have combining marks or a lower-cased variant will be passed through unaltered.

func SlugAscii

func SlugAscii(s string) string

SlugAscii is identical to Slug, except that runs of one or more unicode letters or numbers that still fall outside the ASCII range will have their UTF-8 representation hex encoded and delimited by hyphens. As with Slug, in no case will hyphens appear at either end of the returned string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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