Maintainer | hapytexeu+gh@gmail.com |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
The module to convert text into slugs. A slug is a hyphen separated string of words. Slugs are often used to make visually pleasant URLs by transforming for example the title of an article into a slug, and use this in the URL, for more information see the Wikipedia section.
Synopsis
- data SlugMode
- isWordSeparator :: Char -> Bool
- isWordChar :: Char -> Bool
- isRetainChar :: Char -> Bool
- slugify :: Text -> Text
- slugifyUnicode :: Text -> Text
- slugifyWith :: SlugMode -> Text -> Text
Slug modes
The given mode to slugify a Text
object.
SlugAscii | Slugify by removing diacritics and only retain ASCII characters. |
SlugUnicode | Slugify by allowing unicode characters. |
Instances
Bounded SlugMode Source # | |
Enum SlugMode Source # | |
Eq SlugMode Source # | |
Ord SlugMode Source # | |
Defined in Text.Slugify | |
Read SlugMode Source # | |
Show SlugMode Source # | |
Character tests
:: Char | The given |
-> Bool |
|
Check if the given Char
acter is a word separator, for the given slugify
algorithm.
Check if the given Char
acter is considered a word character for the
slugify algorithm.
:: Char | The given |
-> Bool | True if the given |
Check if the given character is retained by the slugify algorithm.
Slug algorithms
Slugify the given Text
object and remove diacritics and convert
characters to the corresponding ASCII equivalent.
Slugify the given Text
object and retain Unicode characters.