Skip to main content

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
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foliantcontrib.slugs-1.0.0.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

foliantcontrib.slugs-1.0.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page