-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathcommands.html
142 lines (123 loc) · 4.58 KB
/
commands.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{% extends "right-aside.html" %}
{% import "macros/command.html" as commands %}
{% block main_content %}
{% if section.pages | length == 0 %}
<strong>No command pages found.</strong> You likely need to build the command pages. See "Building additional content" in README.md file.
{% endif %}
{% set_global group_descriptions = load_data(path= "../_data/groups.json", required= false) %}
{% set commands_entries = [] %}
<!-- command search box -->
<div class="search-container">
<input type="text" id="search-box" placeholder="Search commands..." onkeyup="searchCommands()" />
</div>
{% for page in 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)
] %}
{% 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 command_data_obj = command_data[command_obj_name] %}
{% set command_display = command_obj_name %}
{% if command_data_obj.container %}
{% set command_display = command_data_obj.container ~ " " ~ command_display %}
{% endif %}
{% set command_entry = [
command_display,
page.permalink | safe,
command_data_obj.summary,
command_data_obj.group
] %}
{% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %}
{% endif %}
{% endfor %}
{% endfor %}
{% set_global grouped = commands_entries | sort(attribute="3") | group_by(attribute="3") %}
{% for command_group_name, command_group in grouped %}
<div class="command-group">
{% set command_group_description_name = command_group_name | replace(from="_", to="-") %}
<h2 id="{{command_group_description_name}}">{{ group_descriptions[command_group_description_name].display }}</h2>
<div class="command-group-meta">
<p><small>{{ group_descriptions[command_group_description_name].description }}</small></p>
<hr />
</div>
{% for entry in command_group | sort(attribute="0") %}
<div class="command-entry"><code><a href="{{ entry[1] }}">{{ entry[0] }}</a></code> {{entry[2]}}</div>
{% endfor %}
<div class="command-group-meta">
<small><a href="#top">Back to top</a></small>
</div>
</div>
{% endfor %}
<script>
function searchCommands() {
var input = document.getElementById("search-box").value.toLowerCase();
var groups = document.querySelectorAll(".command-group");
groups.forEach(function (group) {
var items = group.querySelectorAll(".command-entry");
var found = false;
items.forEach(function (item) {
var text = item.querySelector("a").innerText.toLowerCase();
if (text.includes(input)) {
item.style.display = "";
found = true;
} else {
item.style.display = "none";
}
});
group.style.display = found ? "" : "none";
});
}
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("search-box").focus();
});
</script>
<style>
.search-container {
margin: 20px 0;
text-align: center;
}
#search-box {
width: 60%;
padding: 10px;
font-size: 16px;
border: 2px solid #ddd;
border-radius: 4px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#search-box:focus {
border-color: #007bff;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}
#search-box::placeholder {
color: #aaa;
font-style: italic;
}
</style>
{% endblock main_content %}
{% block related_content %}
<h2 id="top">Command Categories</h2>
<ul>
{% if group_descriptions %}
{% for command_group_name, group_description in group_descriptions %}
{% set replaced_group_id = command_group_name | replace(from="-", to="_") %}
{% if grouped[replaced_group_id] %}<li> <a href="#{{ command_group_name }}">{{ group_description.display }}</a></li>{% endif %}
{% endfor %}
{% endif %}
</ul>
<h2>Alphabetical Command List</h2>
<ul>
{% set alpha_entries = commands_entries | sort(attribute="0") %}
{% for entry in alpha_entries %}
<li><code><a href="{{ entry[1] }}">{{ entry[0] }}</a></code></li>
{% endfor %}
</ul>
{% endblock related_content %}
{% block subhead_content %}
<h1 class="page-title">Documentation: Command Reference</h1>
{% endblock subhead_content %}