Skip to content

Commit c867170

Browse files
authored
Add reply sections to command pages (#183)
They are built from `resp2_replies.json`/`resp3_replies.json` from valkey-doc. If the RESP2/RESP3 replies are equal, only a single section is added. Closes #185 By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License. Signed-off-by: Simon Baatz <[email protected]>
1 parent 607e7c7 commit c867170

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ content/commands/*
88
content/topics/*
99
!content/topics/_index.md
1010
_site
11-
_data/groups.json
11+
_data/groups.json
12+
_data/resp2_replies.json
13+
_data/resp3_replies.json

build/init-commands.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ done
4646

4747
echo "Command stub files created."
4848

49-
grouppath="../${1}/../groups.json"
50-
ln -s $grouppath ./_data/groups.json
49+
for datafile in groups.json resp2_replies.json resp3_replies.json; do
50+
ln -s "../${1}/../${datafile}" "./_data/${datafile}"
5151

52-
echo "Created link to groups.json"
52+
echo "Created link to ${datafile}"
53+
done

templates/command-page.html

+23
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,29 @@
7272
<code>ERROR. Command description not loaded</code><br />
7373
{% endif %}
7474

75+
{% set_global resp2_replies = load_data(path="../_data/resp2_replies.json", required=false) -%}
76+
{% set_global resp3_replies = load_data(path="../_data/resp3_replies.json", required=false) -%}
77+
{% if resp2_replies and resp3_replies -%}
78+
{% set resp2_reply = resp2_replies | get(key=command_title) | join(sep="\n\n") -%}
79+
{% set resp3_reply = resp3_replies | get(key=command_title) | join(sep="\n\n") -%}
80+
81+
{% if resp2_reply or resp3_reply -%}
82+
{% if resp2_reply == resp3_reply -%}
83+
<h3>RESP2/RESP3 Reply</h3>
84+
{{ commands::fix_links(content=resp2_reply) | markdown | safe }}
85+
{% else %}
86+
{% if resp2_reply -%}
87+
<h3>RESP2 Reply</h3>
88+
{{ commands::fix_links(content=resp2_reply) | markdown | safe }}
89+
{% endif -%}
90+
{% if resp3_reply -%}
91+
<h3>RESP3 Reply</h3>
92+
{{ commands::fix_links(content=resp3_reply) | markdown | safe }}
93+
{% endif -%}
94+
{% endif -%}
95+
{% endif -%}
96+
{% endif -%}
97+
7598
{% if command_data_obj and command_data_obj.history %}
7699
<h3>History</h3>
77100
<table>

0 commit comments

Comments
 (0)