Extension for Foliant documentation tool to include YAML-files in config and xml-tag parameters.
Project description
YAMLInclude Extension
YAMLInclude is a configuration extension for Foliant to include parts of configuration from YAML-files.
It resolves !include
YAML tags in the project config and inside XML-tags parameters.
Installation
$ pip install foliantcontrib.include
Usage
The syntax of the !include
YAML tag is:
!include <file>[#<key>]
Where file
may be
- path to local file in Foliant project root,
- direct link to a file on remote server.
An optional #<key>
part is used to get a key from the mapping stored inside <file>
.
Including a local file
Config example:
chapters: !include chapters.yml
In this example the chapters.yml
file should be placed in your Foliant project root.
if the contents of chapters.yml
are as follows:
# chapters.yml
- index.md
- description.md
then the resulting config after applying the extension will be:
chapters:
- index.md
- description.md
Including part of a local file
Config example:
chapters: !include chapters.yml#chapters_for_pdf
In this example the chapters.yml
file should be placed in your Foliant project root.
if the contents of chapters.yml
are as follows:
# chapters.yml
chapters_for_site:
- index_site.md
- description_site.md
chapters_for_pdf:
- index.md
- description.md
then the resulting config after applying the extension will be:
chapters:
- index.md
- description.md
Including a remote file
Config example:
chapters: !include http://example.com/chapters.yml
In this example the chapters.yml
file is stored on the website http://example.com/
.
if the contents of chapters.yml
are as follows:
# chapters.yml
- index.md
- description.md
then the resulting config after applying the extension will be:
chapters:
- index.md
- description.md
Including part of a remote file
Config example:
chapters: !include chapters.yml#chapters_for_pdf
In this example the chapters.yml
file is stored on the website http://example.com/
.
if the contents of chapters.yml
are as follows:
# chapters.yml
chapters_for_site:
- index_site.md
- description_site.md
chapters_for_pdf:
- index.md
- description.md
then the resulting config after applying the extension will be:
chapters:
- index.md
- description.md
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 Distributions
Built Distribution
Hashes for foliantcontrib.yaml_include-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac4f77323b6ffdf3c6b561c22a5cc9b183c16496c53bc41d1364c51a3e8db381 |
|
MD5 | 934f8a6eb5c1b43d58939b4e49db6a96 |
|
BLAKE2b-256 | 84102bef1ebe699993cd16a7bda518f8abc2760aa60cf19fe21690b58a1d4cc3 |