2023-03-21 19:31:49 +03:00
|
|
|
import json
|
|
|
|
|
2023-03-21 07:29:43 +03:00
|
|
|
# https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/
|
|
|
|
def define_env(env):
|
2023-03-21 19:31:49 +03:00
|
|
|
with open("docs/releases.json") as f:
|
|
|
|
for (k, v) in json.load(f).items():
|
|
|
|
env.variables[k] = v
|
|
|
|
|
|
|
|
|
2023-03-21 07:29:43 +03:00
|
|
|
@env.macro
|
2023-03-21 08:01:24 +03:00
|
|
|
def since(vers, outline=False, inline=False):
|
|
|
|
if vers == "nightly":
|
|
|
|
first_line = "*Since: Nightly Builds Only*"
|
|
|
|
expanded = "+"
|
|
|
|
blurb = """
|
2023-04-18 04:00:51 +03:00
|
|
|
The functionality described in this section requires a nightly build of wezterm.
|
2023-03-21 07:29:43 +03:00
|
|
|
You can obtain a nightly build by following the instructions from the
|
|
|
|
[Download](/wezterm/installation.html) section.
|
|
|
|
"""
|
2023-03-21 08:01:24 +03:00
|
|
|
else:
|
|
|
|
first_line = f"*Since: Version {vers}*"
|
|
|
|
expanded = ""
|
|
|
|
blurb = f"""
|
2023-04-18 04:00:51 +03:00
|
|
|
*The functionality described in this section requires version {vers} of wezterm,
|
2023-03-21 08:01:24 +03:00
|
|
|
or a more recent version.*
|
2023-03-21 07:29:43 +03:00
|
|
|
"""
|
|
|
|
|
2023-03-21 08:01:24 +03:00
|
|
|
if outline:
|
2023-03-21 07:29:43 +03:00
|
|
|
return f"""
|
2023-03-21 08:01:24 +03:00
|
|
|
!!! info "{first_line}"
|
|
|
|
{blurb}
|
2023-03-21 07:29:43 +03:00
|
|
|
"""
|
|
|
|
|
2023-03-21 08:01:24 +03:00
|
|
|
if inline:
|
|
|
|
return f"({first_line})"
|
|
|
|
|
2023-03-21 07:29:43 +03:00
|
|
|
return f"""
|
2023-03-21 08:01:24 +03:00
|
|
|
???{expanded} info "{first_line}"
|
|
|
|
{blurb}
|
2023-03-21 07:29:43 +03:00
|
|
|
"""
|