Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions content/command-list/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
title = "Command List"
template = "command-list.html"
page_template = "blog-page.html"
+++
35 changes: 35 additions & 0 deletions templates/command-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% import "macros/command.html" as commands %}

{% set commands_entries = [] %}
{% set commands_section = get_section(path="commands/_index.md") %}
{% for page in commands_section.pages %}

{% for json_path in [
commands::command_json_path(slug=page.slug),
commands::command_bloom_json_path(slug=page.slug),
commands::command_json_json_path(slug=page.slug),
commands::command_search_json_path(slug=page.slug)
] %}
{% set command_data = load_data(path= json_path, required= false) %}
{% if command_data %}
{% set command_obj_name = commands::command_obj_name(command_data= command_data) %}
{% set list_command_data_obj = command_data[command_obj_name] %}
{% set command_display = command_obj_name %}
{% if list_command_data_obj.container %}
{% set command_display = list_command_data_obj.container ~ " " ~ command_display %}
{% endif %}
{% set command_entry = [
command_display,
page.permalink | safe,
list_command_data_obj.summary,
list_command_data_obj.group
] %}
{% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %}
{% endif %}
{% endfor %}
{% endfor %}

{% set alpha_entries = commands_entries | sort(attribute="0") %}
{% for entry in alpha_entries %}
<li class="command-list-item"><code><a href="{{ entry[1] }}">{{ entry[0] }}</a></code></li>
{% endfor %}
46 changes: 11 additions & 35 deletions templates/command-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,34 +225,6 @@ <h3>History</h3>

{% block related_content %}
{# Set up variables for sidebar, similar to commands.html #}
{% set_global group_descriptions = load_data(path= "../_data/groups.json", required= false) %}
{% set commands_entries = [] %}
{% set commands_section = get_section(path="commands/_index.md") %}
{% for page in commands_section.pages %}
{% for json_path in [
commands::command_json_path(slug=page.slug),
commands::command_bloom_json_path(slug=page.slug),
commands::command_json_json_path(slug=page.slug),
commands::command_search_json_path(slug=page.slug)
] %}
{% set command_data = load_data(path= json_path, required= false) %}
{% if command_data %}
{% set command_obj_name = commands::command_obj_name(command_data= command_data) %}
{% set list_command_data_obj = command_data[command_obj_name] %}
{% set command_display = command_obj_name %}
{% if list_command_data_obj.container %}
{% set command_display = list_command_data_obj.container ~ " " ~ command_display %}
{% endif %}
{% set command_entry = [
command_display,
page.permalink | safe,
list_command_data_obj.summary,
list_command_data_obj.group
] %}
{% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %}
{% endif %}
{% endfor %}
{% endfor %}

<div class="sb-search-container">
<input type="text" id="sidebar-search-box" placeholder="Search within documents" onkeyup="searchSidebarCommands()" />
Expand All @@ -266,14 +238,18 @@ <h4>No commands found</h4>
</div>

<h2 id="command-list-title">Alphabetical Command List</h2>
<ul id="command-list">
{% set alpha_entries = commands_entries | sort(attribute="0") %}
{% for entry in alpha_entries %}
<li class="command-list-item"><code><a href="{{ entry[1] }}">{{ entry[0] }}</a></code></li>
{% endfor %}
</ul>

<ul id="command-list"></ul>
<script>
document.addEventListener("DOMContentLoaded", function() {
var
commandListEl = document.getElementById('command-list'),
f = fetch("/command-list/");

f.then((r) => r.text()).then((v) => { commandListEl.innerHTML = v; })
f.catch((error) => { commandListEl.innerHTML = "Could not load command list."; });
});


function searchSidebarCommands() {
var input = document.getElementById("sidebar-search-box").value.toLowerCase();
var commandList = document.getElementById("command-list");
Expand Down