Menu

[bd0f0a]: / mkdocs_macros.py  Maximize  Restore  History

Download this file

49 lines (42 with data), 1.5 kB

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import json
# https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/
def define_env(env):
@env.macro
# Set indent=True when you want to define a box containing version-specific info.
#
# Set inline=True when you want to define a simple inline version indicator,
# such as when emitting information into a table row.
def since(vers, indent=False, inline=False):
scope = "section"
expanded = ""
expander = "???"
rule = ""
if indent:
scope = "outlined box"
expander = "!!!"
rule = " <hr/>"
if vers == "dev":
first_line = "*Since: Dev Builds Only*"
if scope != "section":
expanded = "+"
blurb = f"""
*The functionality described in this {scope} requires a dev build of KumoMTA.
You can obtain a dev build by following the instructions in the
[Installation](/userguide/installation/linux.md) section.*
"""
else:
first_line = f"*Since: Version {vers}*"
blurb = f"""
*The functionality described in this {scope} requires version {vers} of KumoMTA,
or a more recent version.*
"""
if inline:
return f"({first_line})"
# If we're not expandable, don't emit the expanded marker
if expander == "!!!":
expanded = ""
return f"""
{expander}{expanded} info "{first_line}"
{blurb}
{rule}
"""