Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Coachonko/slugify
Generate slug from string, includes custom and language-specific transliterations
https://github.com/Coachonko/slugify
Last synced: about 2 months ago
JSON representation
Generate slug from string, includes custom and language-specific transliterations
- Host: GitHub
- URL: https://github.com/Coachonko/slugify
- Owner: Coachonko
- License: ncsa
- Created: 2023-06-13T13:03:23.000Z (over 1 year ago)
- Default Branch: meester
- Last Pushed: 2023-06-15T15:15:09.000Z (over 1 year ago)
- Last Synced: 2024-04-23T16:38:39.139Z (5 months ago)
- Language: V
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-v - slugify - Transform Unicode strings to url-friendly human-readable ASCII slugs. (Libraries / Text processing)
README
# slugify
Generate slug from string
## Features
- language-specific transliteration toggle
- custom replacement map support
- truncate at maximum character length
- truncate at the end of a word before given maximum character length
- transform to lowercase toggle## Usage
Install with `v install Coachonko.slugify`
```V
import coachonko.slugifyslugifier := slugify.default()
slug := slugifier.make('Slugs are NOT snails') // slugs-are-not-snails
```Please take a look at the test files for more information.
## Notes
`make` and `make_lang` return a string that:
- contains exclusively word characters (`\w`) and hyphens (`-`).
- does not start nor end with hyphens (`-`) or underscores (`_`).
- **may be empty**: if the given string contains exclusively non-word characters and those characters
are not contained in the `substitutions.v` file.Pull requests are welcome to add support for more languages. To add subsitutions or a whole new language,
please look at the [substitutions.v](./substitutions.v) file and at the [CONTRIBUTING.md](./CONTRIBUTING.md)
file.