yamlint 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -9
- data/.serena/.gitignore +1 -0
- data/.serena/memories/project_overview.md +25 -0
- data/.serena/memories/style_and_conventions.md +7 -0
- data/.serena/memories/suggested_commands.md +17 -0
- data/.serena/memories/task_completion.md +5 -0
- data/.serena/project.yml +89 -0
- data/CHANGELOG.md +6 -2
- data/Gemfile +9 -7
- data/LICENSE.txt +1 -1
- data/README.md +155 -17
- data/Rakefile +10 -3
- data/docs/Yamlint/Cli.html +403 -0
- data/docs/Yamlint/Config.html +1034 -0
- data/docs/Yamlint/Formatter.html +433 -0
- data/docs/Yamlint/Linter.html +423 -0
- data/docs/Yamlint/Models/LintContext.html +993 -0
- data/docs/Yamlint/Models/Problem.html +951 -0
- data/docs/Yamlint/Models/Token.html +713 -0
- data/docs/Yamlint/Models.html +117 -0
- data/docs/Yamlint/Output/Base.html +290 -0
- data/docs/Yamlint/Output/Colored.html +293 -0
- data/docs/Yamlint/Output/Github.html +260 -0
- data/docs/Yamlint/Output/Parsable.html +258 -0
- data/docs/Yamlint/Output/Standard.html +270 -0
- data/docs/Yamlint/Output.html +208 -0
- data/docs/Yamlint/Parser/Comment.html +795 -0
- data/docs/Yamlint/Parser/CommentExtractor.html +287 -0
- data/docs/Yamlint/Parser/LineParser.html +423 -0
- data/docs/Yamlint/Parser/TokenParser/Handler.html +910 -0
- data/docs/Yamlint/Parser/TokenParser.html +291 -0
- data/docs/Yamlint/Parser.html +117 -0
- data/docs/Yamlint/Presets.html +266 -0
- data/docs/Yamlint/Rules/Anchors/AnchorHandler.html +678 -0
- data/docs/Yamlint/Rules/Anchors.html +314 -0
- data/docs/Yamlint/Rules/Base.html +968 -0
- data/docs/Yamlint/Rules/Braces.html +335 -0
- data/docs/Yamlint/Rules/Brackets.html +335 -0
- data/docs/Yamlint/Rules/Colons.html +313 -0
- data/docs/Yamlint/Rules/Commas.html +313 -0
- data/docs/Yamlint/Rules/CommentRule.html +298 -0
- data/docs/Yamlint/Rules/Comments.html +317 -0
- data/docs/Yamlint/Rules/CommentsIndentation.html +328 -0
- data/docs/Yamlint/Rules/DocumentEnd.html +332 -0
- data/docs/Yamlint/Rules/DocumentStart.html +332 -0
- data/docs/Yamlint/Rules/EmptyLines.html +300 -0
- data/docs/Yamlint/Rules/EmptyValues.html +273 -0
- data/docs/Yamlint/Rules/FloatValues.html +383 -0
- data/docs/Yamlint/Rules/Hyphens.html +337 -0
- data/docs/Yamlint/Rules/Indentation.html +329 -0
- data/docs/Yamlint/Rules/KeyDuplicates/DuplicateKeyHandler.html +716 -0
- data/docs/Yamlint/Rules/KeyDuplicates.html +258 -0
- data/docs/Yamlint/Rules/KeyOrdering/KeyOrderHandler.html +694 -0
- data/docs/Yamlint/Rules/KeyOrdering.html +258 -0
- data/docs/Yamlint/Rules/LineLength.html +251 -0
- data/docs/Yamlint/Rules/LineRule.html +304 -0
- data/docs/Yamlint/Rules/NewLineAtEndOfFile.html +308 -0
- data/docs/Yamlint/Rules/NewLines.html +310 -0
- data/docs/Yamlint/Rules/OctalValues.html +270 -0
- data/docs/Yamlint/Rules/QuotedStrings.html +381 -0
- data/docs/Yamlint/Rules/Registry.html +492 -0
- data/docs/Yamlint/Rules/TokenRule.html +298 -0
- data/docs/Yamlint/Rules/TrailingSpaces.html +321 -0
- data/docs/Yamlint/Rules/Truthy.html +288 -0
- data/docs/Yamlint/Rules.html +190 -0
- data/docs/Yamlint/Runner.html +551 -0
- data/docs/Yamlint.html +135 -0
- data/docs/_index.html +643 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +490 -0
- data/docs/file.README.html +276 -0
- data/docs/file_list.html +59 -0
- data/docs/frames.html +22 -0
- data/docs/index.html +276 -0
- data/docs/js/app.js +395 -0
- data/docs/js/full_list.js +244 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1582 -0
- data/docs/top-level-namespace.html +110 -0
- data/exe/yamlint +7 -0
- data/lib/yamlint/cli.rb +162 -0
- data/lib/yamlint/config.rb +113 -0
- data/lib/yamlint/formatter.rb +140 -0
- data/lib/yamlint/linter.rb +130 -0
- data/lib/yamlint/models/lint_context.rb +43 -0
- data/lib/yamlint/models/problem.rb +44 -0
- data/lib/yamlint/models/token.rb +22 -0
- data/lib/yamlint/models.rb +9 -0
- data/lib/yamlint/output/base.rb +15 -0
- data/lib/yamlint/output/colored.rb +54 -0
- data/lib/yamlint/output/github.rb +20 -0
- data/lib/yamlint/output/parsable.rb +19 -0
- data/lib/yamlint/output/standard.rb +25 -0
- data/lib/yamlint/output.rb +26 -0
- data/lib/yamlint/parser/comment_extractor.rb +78 -0
- data/lib/yamlint/parser/line_parser.rb +30 -0
- data/lib/yamlint/parser/token_parser.rb +92 -0
- data/lib/yamlint/parser.rb +10 -0
- data/lib/yamlint/presets/default.rb +35 -0
- data/lib/yamlint/presets/relaxed.rb +34 -0
- data/lib/yamlint/presets.rb +19 -0
- data/lib/yamlint/rules/anchors.rb +133 -0
- data/lib/yamlint/rules/base.rb +102 -0
- data/lib/yamlint/rules/braces.rb +105 -0
- data/lib/yamlint/rules/brackets.rb +105 -0
- data/lib/yamlint/rules/colons.rb +73 -0
- data/lib/yamlint/rules/commas.rb +85 -0
- data/lib/yamlint/rules/comments.rb +77 -0
- data/lib/yamlint/rules/comments_indentation.rb +66 -0
- data/lib/yamlint/rules/document_end.rb +45 -0
- data/lib/yamlint/rules/document_start.rb +45 -0
- data/lib/yamlint/rules/empty_lines.rb +107 -0
- data/lib/yamlint/rules/empty_values.rb +43 -0
- data/lib/yamlint/rules/float_values.rb +67 -0
- data/lib/yamlint/rules/hyphens.rb +42 -0
- data/lib/yamlint/rules/indentation.rb +39 -0
- data/lib/yamlint/rules/key_duplicates.rb +127 -0
- data/lib/yamlint/rules/key_ordering.rb +126 -0
- data/lib/yamlint/rules/line_length.rb +57 -0
- data/lib/yamlint/rules/new_line_at_end_of_file.rb +31 -0
- data/lib/yamlint/rules/new_lines.rb +59 -0
- data/lib/yamlint/rules/octal_values.rb +62 -0
- data/lib/yamlint/rules/quoted_strings.rb +73 -0
- data/lib/yamlint/rules/registry.rb +48 -0
- data/lib/yamlint/rules/trailing_spaces.rb +31 -0
- data/lib/yamlint/rules/truthy.rb +48 -0
- data/lib/yamlint/rules.rb +41 -0
- data/lib/yamlint/runner.rb +80 -0
- data/lib/yamlint/version.rb +1 -1
- data/lib/yamlint.rb +11 -3
- metadata +131 -11
- data/CODE_OF_CONDUCT.md +0 -84
- data/sig/yamlint.rbs +0 -4
data/docs/js/app.js
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
window.__app = function () {
|
|
2
|
+
var localStorage = {},
|
|
3
|
+
sessionStorage = {};
|
|
4
|
+
try {
|
|
5
|
+
localStorage = window.localStorage;
|
|
6
|
+
} catch (e) {}
|
|
7
|
+
try {
|
|
8
|
+
sessionStorage = window.sessionStorage;
|
|
9
|
+
} catch (e) {}
|
|
10
|
+
|
|
11
|
+
function createSourceLinks() {
|
|
12
|
+
$(".method_details_list .source_code").before(
|
|
13
|
+
"<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>"
|
|
14
|
+
);
|
|
15
|
+
$(".toggleSource").toggle(
|
|
16
|
+
function () {
|
|
17
|
+
$(this).parent().nextAll(".source_code").slideDown(100);
|
|
18
|
+
$(this).text("Hide source");
|
|
19
|
+
},
|
|
20
|
+
function () {
|
|
21
|
+
$(this).parent().nextAll(".source_code").slideUp(100);
|
|
22
|
+
$(this).text("View source");
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function createDefineLinks() {
|
|
28
|
+
var tHeight = 0;
|
|
29
|
+
$(".defines").after(" <a href='#' class='toggleDefines'>more...</a>");
|
|
30
|
+
$(".toggleDefines").toggle(
|
|
31
|
+
function () {
|
|
32
|
+
tHeight = $(this).parent().prev().height();
|
|
33
|
+
$(this).prev().css("display", "inline");
|
|
34
|
+
$(this).parent().prev().height($(this).parent().height());
|
|
35
|
+
$(this).text("(less)");
|
|
36
|
+
},
|
|
37
|
+
function () {
|
|
38
|
+
$(this).prev().hide();
|
|
39
|
+
$(this).parent().prev().height(tHeight);
|
|
40
|
+
$(this).text("more...");
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function createFullTreeLinks() {
|
|
46
|
+
var tHeight = 0;
|
|
47
|
+
$(".inheritanceTree").toggle(
|
|
48
|
+
function () {
|
|
49
|
+
tHeight = $(this).parent().prev().height();
|
|
50
|
+
$(this).parent().toggleClass("showAll");
|
|
51
|
+
$(this).text("(hide)");
|
|
52
|
+
$(this).parent().prev().height($(this).parent().height());
|
|
53
|
+
},
|
|
54
|
+
function () {
|
|
55
|
+
$(this).parent().toggleClass("showAll");
|
|
56
|
+
$(this).parent().prev().height(tHeight);
|
|
57
|
+
$(this).text("show all");
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function searchFrameButtons() {
|
|
63
|
+
$(".full_list_link").click(function () {
|
|
64
|
+
toggleSearchFrame(this, $(this).attr("href"));
|
|
65
|
+
return false;
|
|
66
|
+
});
|
|
67
|
+
window.addEventListener("message", function (e) {
|
|
68
|
+
if (e.data === "navEscape") {
|
|
69
|
+
$("#nav").slideUp(100);
|
|
70
|
+
$("#search a").removeClass("active inactive");
|
|
71
|
+
$(window).focus();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
$(window).resize(function () {
|
|
76
|
+
if ($("#search:visible").length === 0) {
|
|
77
|
+
$("#nav").removeAttr("style");
|
|
78
|
+
$("#search a").removeClass("active inactive");
|
|
79
|
+
$(window).focus();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function toggleSearchFrame(id, link) {
|
|
85
|
+
var frame = $("#nav");
|
|
86
|
+
$("#search a").removeClass("active").addClass("inactive");
|
|
87
|
+
if (frame.attr("src") === link && frame.css("display") !== "none") {
|
|
88
|
+
frame.slideUp(100);
|
|
89
|
+
$("#search a").removeClass("active inactive");
|
|
90
|
+
} else {
|
|
91
|
+
$(id).addClass("active").removeClass("inactive");
|
|
92
|
+
if (frame.attr("src") !== link) frame.attr("src", link);
|
|
93
|
+
frame.slideDown(100);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function linkSummaries() {
|
|
98
|
+
$(".summary_signature").click(function () {
|
|
99
|
+
document.location = $(this).find("a").attr("href");
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function summaryToggle() {
|
|
104
|
+
$(".summary_toggle").click(function (e) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
localStorage.summaryCollapsed = $(this).text();
|
|
107
|
+
$(".summary_toggle").each(function () {
|
|
108
|
+
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
|
109
|
+
var next = $(this).parent().parent().nextAll("ul.summary").first();
|
|
110
|
+
if (next.hasClass("compact")) {
|
|
111
|
+
next.toggle();
|
|
112
|
+
next.nextAll("ul.summary").first().toggle();
|
|
113
|
+
} else if (next.hasClass("summary")) {
|
|
114
|
+
var list = $('<ul class="summary compact" />');
|
|
115
|
+
list.html(next.html());
|
|
116
|
+
list.find(".summary_desc, .note").remove();
|
|
117
|
+
list.find("a").each(function () {
|
|
118
|
+
$(this).html($(this).find("strong").html());
|
|
119
|
+
$(this).parent().html($(this)[0].outerHTML);
|
|
120
|
+
});
|
|
121
|
+
next.before(list);
|
|
122
|
+
next.toggle();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return false;
|
|
126
|
+
});
|
|
127
|
+
if (localStorage.summaryCollapsed == "collapse") {
|
|
128
|
+
$(".summary_toggle").first().click();
|
|
129
|
+
} else {
|
|
130
|
+
localStorage.summaryCollapsed = "expand";
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function constantSummaryToggle() {
|
|
135
|
+
$(".constants_summary_toggle").click(function (e) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
localStorage.summaryCollapsed = $(this).text();
|
|
138
|
+
$(".constants_summary_toggle").each(function () {
|
|
139
|
+
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
|
140
|
+
var next = $(this).parent().parent().nextAll("dl.constants").first();
|
|
141
|
+
if (next.hasClass("compact")) {
|
|
142
|
+
next.toggle();
|
|
143
|
+
next.nextAll("dl.constants").first().toggle();
|
|
144
|
+
} else if (next.hasClass("constants")) {
|
|
145
|
+
var list = $('<dl class="constants compact" />');
|
|
146
|
+
list.html(next.html());
|
|
147
|
+
list.find("dt").each(function () {
|
|
148
|
+
$(this).addClass("summary_signature");
|
|
149
|
+
$(this).text($(this).text().split("=")[0]);
|
|
150
|
+
if ($(this).has(".deprecated").length) {
|
|
151
|
+
$(this).addClass("deprecated");
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
// Add the value of the constant as "Tooltip" to the summary object
|
|
155
|
+
list.find("pre.code").each(function () {
|
|
156
|
+
var dt_element = $(this).parent().prev();
|
|
157
|
+
var tooltip = $(this).text();
|
|
158
|
+
if (dt_element.hasClass("deprecated")) {
|
|
159
|
+
tooltip = "Deprecated. " + tooltip;
|
|
160
|
+
}
|
|
161
|
+
dt_element.attr("title", tooltip);
|
|
162
|
+
});
|
|
163
|
+
list.find(".docstring, .tags, dd").remove();
|
|
164
|
+
next.before(list);
|
|
165
|
+
next.toggle();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return false;
|
|
169
|
+
});
|
|
170
|
+
if (localStorage.summaryCollapsed == "collapse") {
|
|
171
|
+
$(".constants_summary_toggle").first().click();
|
|
172
|
+
} else {
|
|
173
|
+
localStorage.summaryCollapsed = "expand";
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function generateTOC() {
|
|
178
|
+
if ($("#filecontents").length === 0) return;
|
|
179
|
+
var _toc = $('<ol class="top"></ol>');
|
|
180
|
+
var show = false;
|
|
181
|
+
var toc = _toc;
|
|
182
|
+
var counter = 0;
|
|
183
|
+
var tags = ["h2", "h3", "h4", "h5", "h6"];
|
|
184
|
+
var i;
|
|
185
|
+
var curli;
|
|
186
|
+
if ($("#filecontents h1").length > 1) tags.unshift("h1");
|
|
187
|
+
for (i = 0; i < tags.length; i++) {
|
|
188
|
+
tags[i] = "#filecontents " + tags[i];
|
|
189
|
+
}
|
|
190
|
+
var lastTag = parseInt(tags[0][1], 10);
|
|
191
|
+
$(tags.join(", ")).each(function () {
|
|
192
|
+
if ($(this).parents(".method_details .docstring").length != 0) return;
|
|
193
|
+
if (this.id == "filecontents") return;
|
|
194
|
+
show = true;
|
|
195
|
+
var thisTag = parseInt(this.tagName[1], 10);
|
|
196
|
+
if (this.id.length === 0) {
|
|
197
|
+
var proposedId = $(this).attr("toc-id");
|
|
198
|
+
if (typeof proposedId != "undefined") this.id = proposedId;
|
|
199
|
+
else {
|
|
200
|
+
var proposedId = $(this)
|
|
201
|
+
.text()
|
|
202
|
+
.replace(/[^a-z0-9-]/gi, "_");
|
|
203
|
+
if ($("#" + proposedId).length > 0) {
|
|
204
|
+
proposedId += counter;
|
|
205
|
+
counter++;
|
|
206
|
+
}
|
|
207
|
+
this.id = proposedId;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (thisTag > lastTag) {
|
|
211
|
+
for (i = 0; i < thisTag - lastTag; i++) {
|
|
212
|
+
if (typeof curli == "undefined") {
|
|
213
|
+
curli = $("<li/>");
|
|
214
|
+
toc.append(curli);
|
|
215
|
+
}
|
|
216
|
+
toc = $("<ol/>");
|
|
217
|
+
curli.append(toc);
|
|
218
|
+
curli = undefined;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (thisTag < lastTag) {
|
|
222
|
+
for (i = 0; i < lastTag - thisTag; i++) {
|
|
223
|
+
toc = toc.parent();
|
|
224
|
+
toc = toc.parent();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
var title = $(this).attr("toc-title");
|
|
228
|
+
if (typeof title == "undefined") title = $(this).text();
|
|
229
|
+
curli = $('<li><a href="#' + this.id + '">' + title + "</a></li>");
|
|
230
|
+
toc.append(curli);
|
|
231
|
+
lastTag = thisTag;
|
|
232
|
+
});
|
|
233
|
+
if (!show) return;
|
|
234
|
+
html =
|
|
235
|
+
'<div id="toc"><p class="title hide_toc"><a href="#"><strong>Table of Contents</strong></a></p></div>';
|
|
236
|
+
$("#content").prepend(html);
|
|
237
|
+
$("#toc").append(_toc);
|
|
238
|
+
$("#toc .hide_toc").toggle(
|
|
239
|
+
function () {
|
|
240
|
+
$("#toc .top").slideUp("fast");
|
|
241
|
+
$("#toc").toggleClass("hidden");
|
|
242
|
+
$("#toc .title small").toggle();
|
|
243
|
+
},
|
|
244
|
+
function () {
|
|
245
|
+
$("#toc .top").slideDown("fast");
|
|
246
|
+
$("#toc").toggleClass("hidden");
|
|
247
|
+
$("#toc .title small").toggle();
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function navResizer() {
|
|
253
|
+
const resizer = document.getElementById("resizer");
|
|
254
|
+
resizer.addEventListener(
|
|
255
|
+
"pointerdown",
|
|
256
|
+
function (e) {
|
|
257
|
+
resizer.setPointerCapture(e.pointerId);
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
e.stopPropagation();
|
|
260
|
+
},
|
|
261
|
+
false
|
|
262
|
+
);
|
|
263
|
+
resizer.addEventListener(
|
|
264
|
+
"pointerup",
|
|
265
|
+
function (e) {
|
|
266
|
+
resizer.releasePointerCapture(e.pointerId);
|
|
267
|
+
e.preventDefault();
|
|
268
|
+
e.stopPropagation();
|
|
269
|
+
},
|
|
270
|
+
false
|
|
271
|
+
);
|
|
272
|
+
resizer.addEventListener(
|
|
273
|
+
"pointermove",
|
|
274
|
+
function (e) {
|
|
275
|
+
if ((e.buttons & 1) === 0) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
sessionStorage.navWidth = e.pageX.toString();
|
|
280
|
+
$(".nav_wrap").css("width", Math.max(200, e.pageX));
|
|
281
|
+
e.preventDefault();
|
|
282
|
+
e.stopPropagation();
|
|
283
|
+
},
|
|
284
|
+
false
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
if (sessionStorage.navWidth) {
|
|
288
|
+
$(".nav_wrap").css(
|
|
289
|
+
"width",
|
|
290
|
+
Math.max(200, parseInt(sessionStorage.navWidth, 10))
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function navExpander() {
|
|
296
|
+
if (typeof pathId === "undefined") return;
|
|
297
|
+
var done = false,
|
|
298
|
+
timer = setTimeout(postMessage, 500);
|
|
299
|
+
function postMessage() {
|
|
300
|
+
if (done) return;
|
|
301
|
+
clearTimeout(timer);
|
|
302
|
+
var opts = { action: "expand", path: pathId };
|
|
303
|
+
document.getElementById("nav").contentWindow.postMessage(opts, "*");
|
|
304
|
+
done = true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function mainFocus() {
|
|
309
|
+
var hash = window.location.hash;
|
|
310
|
+
if (hash !== "" && $(hash)[0]) {
|
|
311
|
+
$(hash)[0].scrollIntoView();
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
setTimeout(function () {
|
|
315
|
+
$("#main").focus();
|
|
316
|
+
}, 10);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function navigationChange() {
|
|
320
|
+
// This works around the broken anchor navigation with the YARD template.
|
|
321
|
+
window.onpopstate = function () {
|
|
322
|
+
var hash = window.location.hash;
|
|
323
|
+
if (hash !== "" && $(hash)[0]) {
|
|
324
|
+
$(hash)[0].scrollIntoView();
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
$(document).ready(function () {
|
|
330
|
+
navResizer();
|
|
331
|
+
navExpander();
|
|
332
|
+
createSourceLinks();
|
|
333
|
+
createDefineLinks();
|
|
334
|
+
createFullTreeLinks();
|
|
335
|
+
searchFrameButtons();
|
|
336
|
+
linkSummaries();
|
|
337
|
+
summaryToggle();
|
|
338
|
+
constantSummaryToggle();
|
|
339
|
+
generateTOC();
|
|
340
|
+
mainFocus();
|
|
341
|
+
navigationChange();
|
|
342
|
+
});
|
|
343
|
+
};
|
|
344
|
+
window.__app();
|
|
345
|
+
|
|
346
|
+
window.addEventListener(
|
|
347
|
+
"message",
|
|
348
|
+
async (e) => {
|
|
349
|
+
if (e.data.action === "navigate") {
|
|
350
|
+
const response = await fetch(e.data.url);
|
|
351
|
+
const text = await response.text();
|
|
352
|
+
const parser = new DOMParser();
|
|
353
|
+
const doc = parser.parseFromString(text, "text/html");
|
|
354
|
+
|
|
355
|
+
const classListLink =
|
|
356
|
+
document.getElementById("class_list_link").classList;
|
|
357
|
+
|
|
358
|
+
const content = doc.querySelector("#main").innerHTML;
|
|
359
|
+
document.querySelector("#main").innerHTML = content;
|
|
360
|
+
document.title = doc.head.querySelector("title").innerText;
|
|
361
|
+
document.head.querySelectorAll("script").forEach((script) => {
|
|
362
|
+
if (
|
|
363
|
+
!script.type ||
|
|
364
|
+
(script.type.includes("text/javascript") && !script.src)
|
|
365
|
+
) {
|
|
366
|
+
script.remove();
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
doc.head.querySelectorAll("script").forEach((script) => {
|
|
371
|
+
if (
|
|
372
|
+
!script.type ||
|
|
373
|
+
(script.type.includes("text/javascript") && !script.src)
|
|
374
|
+
) {
|
|
375
|
+
const newScript = document.createElement("script");
|
|
376
|
+
newScript.type = "text/javascript";
|
|
377
|
+
newScript.textContent = script.textContent;
|
|
378
|
+
document.head.appendChild(newScript);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
window.__app();
|
|
383
|
+
|
|
384
|
+
document.getElementById("class_list_link").classList = classListLink;
|
|
385
|
+
|
|
386
|
+
const url = new URL(e.data.url, "https://localhost");
|
|
387
|
+
const hash = decodeURIComponent(url.hash ?? "");
|
|
388
|
+
if (hash) {
|
|
389
|
+
document.getElementById(hash.substring(1)).scrollIntoView();
|
|
390
|
+
}
|
|
391
|
+
history.pushState({}, document.title, e.data.url);
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
false
|
|
395
|
+
);
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
|
|
3
|
+
var $clicked = $(null);
|
|
4
|
+
var searchTimeout = null;
|
|
5
|
+
var searchCache = [];
|
|
6
|
+
var caseSensitiveMatch = false;
|
|
7
|
+
var ignoreKeyCodeMin = 8;
|
|
8
|
+
var ignoreKeyCodeMax = 46;
|
|
9
|
+
var commandKey = 91;
|
|
10
|
+
|
|
11
|
+
RegExp.escape = function(text) {
|
|
12
|
+
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function escapeShortcut() {
|
|
16
|
+
$(document).keydown(function(evt) {
|
|
17
|
+
if (evt.which == 27) {
|
|
18
|
+
window.parent.postMessage('navEscape', '*');
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function clearSearchTimeout() {
|
|
24
|
+
clearTimeout(searchTimeout);
|
|
25
|
+
searchTimeout = null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function enableLinks() {
|
|
29
|
+
// load the target page in the parent window
|
|
30
|
+
$('#full_list li').on('click', function(evt) {
|
|
31
|
+
$('#full_list li').removeClass('clicked');
|
|
32
|
+
$clicked = $(this);
|
|
33
|
+
$clicked.addClass('clicked');
|
|
34
|
+
evt.stopPropagation();
|
|
35
|
+
|
|
36
|
+
if (window.origin === "null") {
|
|
37
|
+
if (evt.target.tagName === 'A') return true;
|
|
38
|
+
|
|
39
|
+
var elem = $clicked.find('> .item .object_link a')[0];
|
|
40
|
+
var e = evt.originalEvent;
|
|
41
|
+
var newEvent = new MouseEvent(evt.originalEvent.type);
|
|
42
|
+
newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
|
|
43
|
+
elem.dispatchEvent(newEvent);
|
|
44
|
+
evt.preventDefault();
|
|
45
|
+
} else {
|
|
46
|
+
window.top.postMessage({
|
|
47
|
+
action: "navigate",
|
|
48
|
+
url: $clicked.find('.object_link a').attr('href'),
|
|
49
|
+
}, "*");
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function enableToggles() {
|
|
56
|
+
// show/hide nested classes on toggle click
|
|
57
|
+
$('#full_list a.toggle').on('click', function(evt) {
|
|
58
|
+
evt.stopPropagation();
|
|
59
|
+
evt.preventDefault();
|
|
60
|
+
$(this).parent().parent().toggleClass('collapsed');
|
|
61
|
+
$(this).attr('aria-expanded', function (i, attr) {
|
|
62
|
+
return attr == 'true' ? 'false' : 'true'
|
|
63
|
+
});
|
|
64
|
+
highlight();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// navigation of nested classes using keyboard
|
|
68
|
+
$('#full_list a.toggle').on('keypress',function(evt) {
|
|
69
|
+
// enter key is pressed
|
|
70
|
+
if (evt.which == 13) {
|
|
71
|
+
evt.stopPropagation();
|
|
72
|
+
evt.preventDefault();
|
|
73
|
+
$(this).parent().parent().toggleClass('collapsed');
|
|
74
|
+
$(this).attr('aria-expanded', function (i, attr) {
|
|
75
|
+
return attr == 'true' ? 'false' : 'true'
|
|
76
|
+
});
|
|
77
|
+
highlight();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function populateSearchCache() {
|
|
83
|
+
$('#full_list li .item').each(function() {
|
|
84
|
+
var $node = $(this);
|
|
85
|
+
var $link = $node.find('.object_link a');
|
|
86
|
+
if ($link.length > 0) {
|
|
87
|
+
searchCache.push({
|
|
88
|
+
node: $node,
|
|
89
|
+
link: $link,
|
|
90
|
+
name: $link.text(),
|
|
91
|
+
fullName: $link.attr('title').split(' ')[0]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function enableSearch() {
|
|
98
|
+
$('#search input').keyup(function(event) {
|
|
99
|
+
if (ignoredKeyPress(event)) return;
|
|
100
|
+
if (this.value === "") {
|
|
101
|
+
clearSearch();
|
|
102
|
+
} else {
|
|
103
|
+
performSearch(this.value);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
$('#full_list').after("<div id='noresults' role='status' style='display: none'></div>");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function ignoredKeyPress(event) {
|
|
111
|
+
if (
|
|
112
|
+
(event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
|
|
113
|
+
(event.keyCode == commandKey)
|
|
114
|
+
) {
|
|
115
|
+
return true;
|
|
116
|
+
} else {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function clearSearch() {
|
|
122
|
+
clearSearchTimeout();
|
|
123
|
+
$('#full_list .found').removeClass('found').each(function() {
|
|
124
|
+
var $link = $(this).find('.object_link a');
|
|
125
|
+
$link.text($link.text());
|
|
126
|
+
});
|
|
127
|
+
$('#full_list, #content').removeClass('insearch');
|
|
128
|
+
$clicked.parents().removeClass('collapsed');
|
|
129
|
+
highlight();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function performSearch(searchString) {
|
|
133
|
+
clearSearchTimeout();
|
|
134
|
+
$('#full_list, #content').addClass('insearch');
|
|
135
|
+
$('#noresults').text('').hide();
|
|
136
|
+
partialSearch(searchString, 0);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function partialSearch(searchString, offset) {
|
|
140
|
+
var lastRowClass = '';
|
|
141
|
+
var i = null;
|
|
142
|
+
for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
|
|
143
|
+
var item = searchCache[i];
|
|
144
|
+
var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
|
|
145
|
+
var matchString = buildMatchString(searchString);
|
|
146
|
+
var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
|
|
147
|
+
if (searchName.match(matchRegexp) == null) {
|
|
148
|
+
item.node.removeClass('found');
|
|
149
|
+
item.link.text(item.link.text());
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
item.node.addClass('found');
|
|
153
|
+
item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
|
|
154
|
+
lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
|
|
155
|
+
item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if(i == searchCache.length) {
|
|
159
|
+
searchDone();
|
|
160
|
+
} else {
|
|
161
|
+
searchTimeout = setTimeout(function() {
|
|
162
|
+
partialSearch(searchString, i);
|
|
163
|
+
}, 0);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function searchDone() {
|
|
168
|
+
searchTimeout = null;
|
|
169
|
+
highlight();
|
|
170
|
+
var found = $('#full_list li:visible').size();
|
|
171
|
+
if (found === 0) {
|
|
172
|
+
$('#noresults').text('No results were found.');
|
|
173
|
+
} else {
|
|
174
|
+
// This is read out to screen readers
|
|
175
|
+
$('#noresults').text('There are ' + found + ' results.');
|
|
176
|
+
}
|
|
177
|
+
$('#noresults').show();
|
|
178
|
+
$('#content').removeClass('insearch');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function buildMatchString(searchString, event) {
|
|
182
|
+
caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
|
|
183
|
+
var regexSearchString = RegExp.escape(searchString);
|
|
184
|
+
if (caseSensitiveMatch) {
|
|
185
|
+
regexSearchString += "|" +
|
|
186
|
+
$.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
|
|
187
|
+
join('.+?');
|
|
188
|
+
}
|
|
189
|
+
return regexSearchString;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function highlight() {
|
|
193
|
+
$('#full_list li:visible').each(function(n) {
|
|
194
|
+
$(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function isInView(element) {
|
|
199
|
+
const rect = element.getBoundingClientRect();
|
|
200
|
+
const windowHeight =
|
|
201
|
+
window.innerHeight || document.documentElement.clientHeight;
|
|
202
|
+
return rect.left >= 0 && rect.bottom <= windowHeight;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Expands the tree to the target element and its immediate
|
|
207
|
+
* children.
|
|
208
|
+
*/
|
|
209
|
+
function expandTo(path) {
|
|
210
|
+
var $target = $(document.getElementById('object_' + path));
|
|
211
|
+
$target.addClass('clicked');
|
|
212
|
+
$target.removeClass('collapsed');
|
|
213
|
+
$target.parentsUntil('#full_list', 'li').removeClass('collapsed');
|
|
214
|
+
|
|
215
|
+
$target.find('a.toggle').attr('aria-expanded', 'true')
|
|
216
|
+
$target.parentsUntil('#full_list', 'li').each(function(i, el) {
|
|
217
|
+
$(el).find('> div > a.toggle').attr('aria-expanded', 'true');
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
if($target[0] && !isInView($target[0])) {
|
|
221
|
+
window.scrollTo(window.scrollX, $target.offset().top - 250);
|
|
222
|
+
highlight();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function windowEvents(event) {
|
|
227
|
+
var msg = event.data;
|
|
228
|
+
if (msg.action === "expand") {
|
|
229
|
+
expandTo(msg.path);
|
|
230
|
+
}
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
window.addEventListener("message", windowEvents, false);
|
|
235
|
+
|
|
236
|
+
$(document).ready(function() {
|
|
237
|
+
escapeShortcut();
|
|
238
|
+
enableLinks();
|
|
239
|
+
enableToggles();
|
|
240
|
+
populateSearchCache();
|
|
241
|
+
enableSearch();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
})();
|