fork/wezterm

git clone https://git.julia.blue/fork/wezterm

Wez Furlongdocs: fixup absolute link warning for {{since(nightly)}}0fd76a77c

termwiz-0.23.2
1.2 KiB43 linesraw
1import json
2
3# https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/
4def define_env(env):
5    with open("docs/releases.json") as f:
6        for (k, v) in json.load(f).items():
7            env.variables[k] = v
8
9
10    @env.macro
11    def since(vers, outline=False, inline=False):
12        if vers == "nightly":
13            # Determine the relative path traversal to the root,
14            # so that we can emit the link to the install page
15            rel_root = "../" * (len(env.page.url.split('/')) - 1)
16            first_line = "*Since: Nightly Builds Only*"
17            expanded = "+"
18            blurb = f"""
19    The functionality described in this section requires a nightly build of wezterm.
20    You can obtain a nightly build by following the instructions from the
21    [Download]({rel_root}installation.md) section.
22"""
23        else:
24            first_line = f"*Since: Version {vers}*"
25            expanded = ""
26            blurb = f"""
27    *The functionality described in this section requires version {vers} of wezterm,
28    or a more recent version.*
29"""
30
31        if outline:
32            return f"""
33!!! info "{first_line}"
34{blurb}
35"""
36
37        if inline:
38            return f"({first_line})"
39
40        return f"""
41???{expanded} info "{first_line}"
42{blurb}
43"""