Skip to main content

YAMLInclude Extension

YAMLInclude is a configuration extension for Foliant to include parts of configuration from YAML-files.

It resolves !include YAML tag in the project config and inside XML-tags parameters.

Installation

$ pip install foliantcontrib.yaml_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 http://example.com/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

Metadata

Release files for foliantcontrib.yaml-include 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foliantcontrib.yaml-include 1.0.1
File Size Uploaded
foliantcontrib.yaml_include-1.0.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for foliantcontrib.yaml-include 1.0.1
File Interpreter ABI Platform
foliantcontrib.yaml_include-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / foliantcontrib.yaml_include-1.0.1.tar.gz

Download URL foliantcontrib.yaml_include-1.0.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b86c770724870483bfff48e65b45bf1a7cc604a7e574bce9b1d5e98193b5965b
BLAKE2b-256 checksum
How to use checksums
0068e7a96397063e768b5a4987182b02c00cd9c2bff4f91f0db50dcc9caa922b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

Release files / foliantcontrib.yaml_include-1.0.1-py3-none-any.whl

Download URL foliantcontrib.yaml_include-1.0.1-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f00db5344acc9f8c81dff4b85c6f3121d678e683b3e487edc9c96f17e549970
BLAKE2b-256 checksum
How to use checksums
95ed13056c7cb5b51a265713f344ab5fac0bf5eb192bf99c3f4cbfa34b3beaff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page