Skip to main content

Glossary collector for Foliant

Glossary preprocessor collects terms and definitions from the files stated and inserts them to specified places of the document.

Installation

$ pip install foliantcontrib.glossary

Config

To enable the preprocessor, add glossary to preprocessors section in the project config.

preprocessors:
  - glossary

The preprocessor has a number of options (default values stated below):

preprocessors:
  - glossary:
        term_definitions: 'term_definitions.md'
        definition_mark: ':   '
        files_to_process: ''

term_definitions : Local or remote file with terms and definitions in Pandoc definition_lists notation (by default this file stored in foliant project folder, but you can place it other folder). Also you can use includes in this file to join several glossary files. In this case includes preprocessor should be stated before glossary in foliant.yml preprocessors section. Note that if several definitions of one term are found, only first will be used.

definition_mark : Preprocessor uses this string to determine, if the definition should be inserted here. ": " for Pandoc definition_lists notation.

files_to_process : You can set certain files to process by preprocessor.

Usage

Just add the preprocessor to the project config, set it up and enjoy the automatically collected glossary in your document.

Example

foliant.yml

...
chapters:
    - text.md

preprocessors:
...
    - includes
    - glossary
...

term_definitions.md

# Glossary

<include nohead="true">
    $https://git.repo/repo_name_1$src/glossary_1.md
</include>

<include nohead="true">
    $https://git.repo/repo_name_2$src/glossary_2.md
</include>

glossary_1.md from repo_1

# Glossary

Term 1

:   Definition 1

Term 2

:   Definition 2

Term 3

:   Definition 3

glossary_2.md from repo_2

# Glossary

Term 4

:   Definition 4

        { some code, part of Definition 4 }

    Third paragraph of definition 4.

Term 5

:   Definition 5

text.md

# Main chapter

Some text.

# Glossary

:   Term 1

:   Term 4

:   Term 2

__all__.md

# Main chapter

Some text.

# Glossary

Term 1

:   Definition 1


Term 4

:   Definition 4

        { some code, part of Definition 4 }

    Third paragraph of definition 4.


Term 2

:   Definition 2

Release files for foliantcontrib.glossary 1.0.0

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.glossary 1.0.0
File Size Uploaded
foliantcontrib.glossary-1.0.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for foliantcontrib.glossary 1.0.0
File Interpreter ABI Platform
foliantcontrib.glossary-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / foliantcontrib.glossary-1.0.0.tar.gz

Download URL foliantcontrib.glossary-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
715b2fbf04b95e2ab671bc390a04762f57fc6fa7b34cfd4c5cb22f44e1010366
BLAKE2b-256 checksum
How to use checksums
4e22b992b179e42dca889c86943e06f31bcd0cbaa4ff26ac5a155e297fefe840
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

Release files / foliantcontrib.glossary-1.0.0-py3-none-any.whl

Download URL foliantcontrib.glossary-1.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49d86fe79ec07a1c97814eb83c236c3155d318a0e7b2d4eaf28165bed662b8eb
BLAKE2b-256 checksum
How to use checksums
5ce0f3a6e033a6310a214376fdad86f682bb44417d70d1d97696fa1d60659a77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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