Extension for Foliant documentation tools to generate custom slugs.
Project description
# Slugs Extension
Slugs is an extension for Foliant to generate custom slugs from arbitrary lists of values.
It resolves `!slug` and `!date` YAML tags in the project config.
The list of values after the ``!slug`` tag is replaced with the string that joins these values using ``-`` delimeter. Spaces (` `) in the values are replaced with underscores (`_`).
The value of the node that contains the `!date` tag is replaced with the current local date.
## Installation
```bash
$ pip install foliantcontrib.slugs
```
## Usage
Config example:
```yaml
title: &title My Awesome Project
version: &version 1.0
slug: !slug
- *title
- *version
- !date
```
Example of the resulting slug:
```
My_Awesome_Project-1.0-2018-05-10
```
Note that backends allow to override the top-level slug, so you may define different custom slugs for each backend:
```yaml
backend_config:
pandoc:
slug: !slug
- *title
- *version
- !date
mkdocs:
slug: my_awesome_project
```
Slugs is an extension for Foliant to generate custom slugs from arbitrary lists of values.
It resolves `!slug` and `!date` YAML tags in the project config.
The list of values after the ``!slug`` tag is replaced with the string that joins these values using ``-`` delimeter. Spaces (` `) in the values are replaced with underscores (`_`).
The value of the node that contains the `!date` tag is replaced with the current local date.
## Installation
```bash
$ pip install foliantcontrib.slugs
```
## Usage
Config example:
```yaml
title: &title My Awesome Project
version: &version 1.0
slug: !slug
- *title
- *version
- !date
```
Example of the resulting slug:
```
My_Awesome_Project-1.0-2018-05-10
```
Note that backends allow to override the top-level slug, so you may define different custom slugs for each backend:
```yaml
backend_config:
pandoc:
slug: !slug
- *title
- *version
- !date
mkdocs:
slug: my_awesome_project
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for foliantcontrib.slugs-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65357e73d8b041c2f44d028da55e68aa94a5172e5c1751c2a57152ee156c99ca |
|
MD5 | 5aaad3d81b802095b044b7a75d2b43df |
|
BLAKE2b-256 | 96c566ad320561d50b3e458f404c83a562201ff18f4c27c18235b72c28110231 |
Close
Hashes for foliantcontrib.slugs-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2154ea66f8fe2f429b41706dfbebb8e0b1fff2fc34ab958048a2d26ae4b2ee9 |
|
MD5 | f9cafd12394db0b5b7c499a05412911d |
|
BLAKE2b-256 | 69bd978fb1962943cce061afe7405b980a24553e23b490c00933fd392f551ca1 |