Metadata for Foliant.
Project description
Metadata for Foliant
This extension adds the meta generate
command to Foliant, which generates the yaml-file with project metadata. It also allows to add other meta commands meta <command>
which use the generated metadata.
It also adds the preprocessor meta
which removes metadata blocks from the documents before builds and allows inserting formatted strings on the place of meta blocks, based on specific metadata keys.
Installation
$ pip install foliantcontrib.meta
Specifying metadata
Metadata may be specified in the beginning of a Markdown-file using YAML Front Matter format:
---
id: MAIN_DOC
title: Description of the product
key: value
---
You can also specify metadata in the middle of the document. In this case it should appear just after a heading of any level:
## System protocol description
---
title: System protocol
relates: MAIN_DOC
---
Each new metadata block means a new section of the chapter.
meta generate
command
Usage
To generate meta file run the meta generate
command:
$ foliant meta generate
Metadata for the document will appear in the meta.yml
file.
Config
Meta generate command has just one option right now. It is specified under meta
section in config:
meta:
filename: meta.yml
filename
: name of the YAML-file with generated project metadata.
meta
preprocessor
meta
preprocessor is necessary if you add metadata into the middle of your documents: it removes the metadata blocks before building the document so it won't get to the result.
This preprocessor also offers you a feature which we call seeds:
Seeds are little string templates which will appear after the metadata block in the resulting document, if specific keys were mentioned in the metadata. Details in the Seeds section.
Usage
Add meta
preprocessor to your preprocessors
section of foliant.yml and specify all your seeds:
preprocessors:
- meta:
seeds:
section: '*Section "{value}"*'
id: <anchor>{value}</anchor>
Seeds
Seeds allow you to add small chunks of text based on specific keys mentioned in the metadata block. For example, if you wish to add a small subcaption at the beginning of every section, which will use this section's name, add a section
seed:
preprocessors:
- meta:
seeds:
section: '*Section "{value}"*'
If we have a meta block like this in our document:
# Terms of use
---
ID: legal_info
relates: index.md
section: Legal information
---
Preprocessor will notice that section
key was used in the meta block, and will add the seed with {value}
placeholder replaced by the value of the section
field:
# Terms of use
*Section "Legal information"
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
Hashes for foliantcontrib.meta-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6477b821c841e8688568520a183b87883f511c11353d6296512b8c6be23f051b |
|
MD5 | ef50a973addbfdd4e545fd0e32e225d7 |
|
BLAKE2b-256 | b4b874ac48e8ac448c06488c63de875e4383ac3aaa64a0786cae9818783ea401 |
Hashes for foliantcontrib.meta-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 673c8ca42a2facf6991382b6e31dfc4ccb91000bcc85a26c13a6f433bfa905c6 |
|
MD5 | c5654fdb2c0ac2a313d55439d46716f9 |
|
BLAKE2b-256 | 93674026c450e676c1cc256d84223df1f6a4866a72724a53f95d325e33238286 |