mirror of
https://github.com/wez/wezterm.git
synced 2024-09-11 14:25:57 +03:00
docs: simplify templating of install pages
This commit is contained in:
parent
0b83c97427
commit
19c9bc84f2
2
.gitignore
vendored
2
.gitignore
vendored
@ -15,8 +15,8 @@ dhat-heap.json
|
||||
/termwiz/codegen/target
|
||||
/termwiz/codegen/Cargo.lock
|
||||
/gh_pages/
|
||||
/docs/releases.json
|
||||
/docs/SUMMARY.md
|
||||
/docs/install/*.md
|
||||
/docs/cli/cli/index.md
|
||||
/docs/recipes/index.md
|
||||
/docs/colorschemes/**/index.md
|
||||
|
@ -8,7 +8,7 @@ done
|
||||
|
||||
tracked_markdown=$(mktemp)
|
||||
trap "rm ${tracked_markdown}" "EXIT"
|
||||
git ls-tree -r HEAD --name-only docs | egrep '\.(markdown|md)$' > $tracked_markdown
|
||||
find docs -type f | egrep '\.(markdown|md)$' > $tracked_markdown
|
||||
|
||||
gelatyx --language lua --file-list $tracked_markdown --language-config ci/stylua.toml
|
||||
gelatyx --language lua --file-list $tracked_markdown --language-config ci/stylua.toml --check || exit 1
|
||||
|
@ -305,7 +305,7 @@ function load_scheme_player(ident) {{
|
||||
idx.write(
|
||||
f"""
|
||||
```lua
|
||||
config.color_scheme = "{title}"
|
||||
config.color_scheme = '{title}'
|
||||
```
|
||||
|
||||
"""
|
||||
|
@ -50,9 +50,9 @@ def build_subst(subst, stable, categorized):
|
||||
continue
|
||||
url, name, dir = info
|
||||
kind = f"{kind}_{stable}"
|
||||
subst["{{ %s }}" % kind] = url
|
||||
subst["{{ %s_asset }}" % kind] = name
|
||||
subst["{{ %s_dir }}" % kind] = dir
|
||||
subst[kind] = url
|
||||
subst[f"{kind}_asset"] = name
|
||||
subst[f"{kind}_dir"] = dir
|
||||
|
||||
|
||||
def load_release_info():
|
||||
@ -83,21 +83,9 @@ def load_release_info():
|
||||
subst = {}
|
||||
build_subst(subst, "stable", latest)
|
||||
build_subst(subst, "nightly", nightly)
|
||||
# print(pretty(subst))
|
||||
|
||||
for name in [
|
||||
"install/windows",
|
||||
"install/macos",
|
||||
"install/linux",
|
||||
"install/source",
|
||||
"install/freebsd",
|
||||
]:
|
||||
with open(f"docs/{name}.markdown", "r") as input:
|
||||
with open(f"docs/{name}.md", "w") as output:
|
||||
for line in input:
|
||||
for search, replace in subst.items():
|
||||
line = line.replace(search, replace)
|
||||
output.write(line)
|
||||
with open(f"docs/releases.json", "w") as output:
|
||||
json.dump(subst, output)
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -1,5 +1,12 @@
|
||||
import json
|
||||
|
||||
# https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/
|
||||
def define_env(env):
|
||||
with open("docs/releases.json") as f:
|
||||
for (k, v) in json.load(f).items():
|
||||
env.variables[k] = v
|
||||
|
||||
|
||||
@env.macro
|
||||
def since(vers, outline=False, inline=False):
|
||||
if vers == "nightly":
|
||||
|
Loading…
Reference in New Issue
Block a user