Skip to content

Commit

Permalink
Add reply sections to command pages
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
  • Loading branch information
gmbnomis committed Dec 21, 2024
1 parent 9ce6a30 commit a222e9f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ content/commands/*
content/topics/*
!content/topics/_index.md
_site
_data/groups.json
_data/groups.json
_data/resp2_replies.json
_data/resp3_replies.json
7 changes: 4 additions & 3 deletions build/init-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ done

echo "Command stub files created."

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

echo "Created link to groups.json"
echo "Created link to ${datafile}"
done
23 changes: 23 additions & 0 deletions templates/command-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,29 @@
<code>ERROR. Command description not loaded</code><br />
{% endif %}

{% set_global resp2_replies = load_data(path="../_data/resp2_replies.json", required=false) -%}
{% set_global resp3_replies = load_data(path="../_data/resp3_replies.json", required=false) -%}
{% if resp2_replies and resp3_replies -%}
{% set resp2_reply = resp2_replies | get(key=command_title) | join(sep="\n\n") -%}
{% set resp3_reply = resp3_replies | get(key=command_title) | join(sep="\n\n") -%}

{% if resp2_reply or resp3_reply -%}
{% if resp2_reply == resp3_reply -%}
<h3>RESP2/RESP3 Reply</h3>
{{ commands::fix_links(content=resp2_reply) | markdown | safe }}
{% else %}
{% if resp2_reply -%}
<h3>RESP2 Reply</h3>
{{ commands::fix_links(content=resp2_reply) | markdown | safe }}
{% endif -%}
{% if resp3_reply -%}
<h3>RESP3 Reply</h3>
{{ commands::fix_links(content=resp3_reply) | markdown | safe }}
{% endif -%}
{% endif -%}
{% endif -%}
{% endif -%}

{% if command_data_obj and command_data_obj.history %}
<h3>History</h3>
<table>
Expand Down

0 comments on commit a222e9f

Please sign in to comment.