-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmacro_hooks.py
More file actions
25 lines (19 loc) · 848 Bytes
/
macro_hooks.py
File metadata and controls
25 lines (19 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
Allows injection of variables into macro stage of rendering.
This allows for arbitrary use of variables in ARTICLES, (e.g. `docs/.md`).
As opposed to `mkdocs_hooks.py` which works only in template step, (e.g. `overrides/*.html`).
If this is confusing, ask Cal to explain.
"""
import os
import json
module_list_path = os.getenv("MODULE_LIST_PATH", "docs/assets/module-list.json")
def define_env(env):
"""
This is the hook for defining variables, macros and filters
- variables: the dictionary that contains the environment variables
- macro: a decorator function, to declare a macro.
- filter: a function with one of more arguments,
used to perform a transformation
"""
# add to the dictionary of variables available to markdown pages:
env.variables.applications = json.load(open(module_list_path))