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
---
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 allows you to remove metadata from your Markdown source files before build. It may be necessary if some backend doesn't accept the YAML Front Matter syntax.
This preprocessor also offers you a feature which we call seeds:
Seeds are little string templates which will may be used to add some text 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:
delete_meta: true
seeds:
section: '*Section "{value}"*'
id: <anchor>{value}</anchor>
delete_meta
: If set to true
— metadata block will be deleted from the document before build. Default: false
seeds
: Seeds dictionary. Details in the next section.
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 the document, which will use this document's title, add the title
seed:
preprocessors:
- meta:
seeds:
title: '*Section "{value}"*'
If we have a meta block like this in our document:
---
ID: legal_info
relates: index.md
title: Legal information
---
# Terms of use
Preprocessor will notice that title
key was used in the meta block, and will add the seed with {value}
placeholder replaced by the value of the title
field:
*Section "Legal information"
# Terms of use
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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bc5f8facb6e33e3cd2782c4183b59603dabd30161187789f2762602875008e2 |
|
MD5 | 824c39db6a46da98b05b989e2549b0ed |
|
BLAKE2b-256 | e68559139e99809332d7e5de20cfa0060d646b1108da6568c7b151572f4f8259 |
Hashes for foliantcontrib.meta-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0d73d4d33565754357ac9302d484ded8b66f6372c903c1df4c5328c33c29843 |
|
MD5 | 172fe25521d2a6289cfd35e106aaf01b |
|
BLAKE2b-256 | db243f84f5f2a07f2882cf2d1ce0ad5ddf7e696f9b30bfcce17905a8cb82e204 |