yard 0.9.38 → 0.9.43
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/CHANGELOG.md +50 -1
- data/README.md +18 -21
- data/docs/GettingStarted.md +41 -15
- data/docs/Parser.md +17 -42
- data/docs/Tags.md +5 -5
- data/docs/WhatsNew.md +59 -7
- data/docs/templates/default/yard_tags/html/setup.rb +1 -1
- data/lib/yard/autoload.rb +17 -0
- data/lib/yard/cli/diff.rb +7 -2
- data/lib/yard/code_objects/proxy.rb +1 -1
- data/lib/yard/handlers/processor.rb +1 -0
- data/lib/yard/handlers/rbs/attribute_handler.rb +79 -0
- data/lib/yard/handlers/rbs/base.rb +38 -0
- data/lib/yard/handlers/rbs/constant_handler.rb +18 -0
- data/lib/yard/handlers/rbs/method_handler.rb +327 -0
- data/lib/yard/handlers/rbs/mixin_handler.rb +20 -0
- data/lib/yard/handlers/rbs/namespace_handler.rb +26 -0
- data/lib/yard/handlers/ruby/attribute_handler.rb +7 -4
- data/lib/yard/handlers/ruby/constant_handler.rb +1 -0
- data/lib/yard/i18n/locale.rb +1 -1
- data/lib/yard/i18n/pot_generator.rb +1 -1
- data/lib/yard/parser/rbs/rbs_parser.rb +325 -0
- data/lib/yard/parser/rbs/statement.rb +75 -0
- data/lib/yard/parser/ruby/legacy/irb/slex.rb +19 -1
- data/lib/yard/parser/ruby/ruby_parser.rb +55 -3
- data/lib/yard/parser/source_parser.rb +3 -2
- data/lib/yard/registry_resolver.rb +7 -0
- data/lib/yard/rubygems/specification.rb +1 -1
- data/lib/yard/server/commands/base.rb +1 -1
- data/lib/yard/server/library_version.rb +1 -1
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +168 -88
- data/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +203 -12
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +1 -17
- data/lib/yard/server/templates/default/method_details/html/permalink.erb +4 -2
- data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +3 -3
- data/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +2 -3
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +22 -16
- data/lib/yard/tags/directives.rb +7 -0
- data/lib/yard/tags/library.rb +3 -3
- data/lib/yard/tags/types_explainer.rb +2 -1
- data/lib/yard/templates/helpers/base_helper.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +16 -5
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +6 -1
- data/lib/yard/templates/helpers/markup/hybrid_markdown.rb +2147 -0
- data/lib/yard/templates/helpers/markup_helper.rb +4 -2
- data/lib/yard/version.rb +1 -1
- data/po/ja.po +82 -82
- data/templates/default/fulldoc/html/css/common.css +1 -1
- data/templates/default/fulldoc/html/css/full_list.css +201 -53
- data/templates/default/fulldoc/html/css/style.css +988 -389
- data/templates/default/fulldoc/html/full_list.erb +4 -4
- data/templates/default/fulldoc/html/js/app.js +801 -395
- data/templates/default/fulldoc/html/js/full_list.js +332 -242
- data/templates/default/layout/html/headers.erb +1 -1
- data/templates/default/layout/html/layout.erb +3 -1
- data/templates/default/method/html/header.erb +3 -3
- data/templates/default/module/html/defines.erb +3 -3
- data/templates/default/module/html/inherited_methods.erb +1 -0
- data/templates/default/module/html/method_summary.erb +8 -0
- data/templates/default/module/setup.rb +20 -0
- data/templates/default/onefile/html/layout.erb +3 -4
- data/templates/guide/fulldoc/html/css/style.css +347 -97
- data/templates/guide/fulldoc/html/js/app.js +61 -33
- data/templates/guide/layout/html/layout.erb +69 -72
- metadata +14 -4
|
@@ -1,244 +1,334 @@
|
|
|
1
|
-
(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
});
|
|
1
|
+
(() => {
|
|
2
|
+
let clicked = null;
|
|
3
|
+
let searchTimeout = null;
|
|
4
|
+
const searchCache = [];
|
|
5
|
+
let caseSensitiveMatch = false;
|
|
243
6
|
|
|
7
|
+
function query(selector, root) {
|
|
8
|
+
return (root || document).querySelector(selector);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function queryAll(selector, root) {
|
|
12
|
+
return Array.prototype.slice.call(
|
|
13
|
+
(root || document).querySelectorAll(selector),
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function isVisible(element) {
|
|
18
|
+
if (!element) return false;
|
|
19
|
+
if (window.getComputedStyle(element).display === "none") return false;
|
|
20
|
+
if (element.parentElement && element.parentElement !== document.body) {
|
|
21
|
+
return isVisible(element.parentElement);
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
RegExp.escape = (text) => text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
27
|
+
|
|
28
|
+
function ready(callback) {
|
|
29
|
+
if (document.readyState === "loading") {
|
|
30
|
+
document.addEventListener("DOMContentLoaded", callback, { once: true });
|
|
31
|
+
} else {
|
|
32
|
+
callback();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function escapeShortcut() {
|
|
37
|
+
document.addEventListener("keydown", (event) => {
|
|
38
|
+
if (event.key === "Escape") {
|
|
39
|
+
window.parent.postMessage("navEscape", "*");
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function clearSearchTimeout() {
|
|
45
|
+
clearTimeout(searchTimeout);
|
|
46
|
+
searchTimeout = null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function setClicked(item) {
|
|
50
|
+
queryAll("#full_list li.clicked").forEach((node) => {
|
|
51
|
+
node.classList.remove("clicked");
|
|
52
|
+
});
|
|
53
|
+
clicked = item;
|
|
54
|
+
if (clicked) clicked.classList.add("clicked");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function pathForItem(item) {
|
|
58
|
+
if (!item?.id || item.id.indexOf("object_") !== 0) return null;
|
|
59
|
+
return item.id.substring("object_".length);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function enableLinks() {
|
|
63
|
+
queryAll("#full_list li").forEach((item) => {
|
|
64
|
+
const itemRow = item.querySelector(":scope > .item");
|
|
65
|
+
|
|
66
|
+
if (!itemRow) return;
|
|
67
|
+
|
|
68
|
+
itemRow.addEventListener("click", (event) => {
|
|
69
|
+
let targetLink;
|
|
70
|
+
let url;
|
|
71
|
+
|
|
72
|
+
if (
|
|
73
|
+
event.defaultPrevented ||
|
|
74
|
+
event.button !== 0 ||
|
|
75
|
+
event.metaKey ||
|
|
76
|
+
event.ctrlKey ||
|
|
77
|
+
event.shiftKey ||
|
|
78
|
+
event.altKey
|
|
79
|
+
) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
setClicked(item);
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
targetLink = event.target.closest("a");
|
|
86
|
+
if (!targetLink?.matches(".object_link a")) {
|
|
87
|
+
targetLink = item.querySelector(":scope > .item .object_link a");
|
|
88
|
+
}
|
|
89
|
+
if (!targetLink) return false;
|
|
90
|
+
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
url = targetLink.getAttribute("href");
|
|
93
|
+
try {
|
|
94
|
+
url = new URL(url, window.location.href).href;
|
|
95
|
+
} catch (_error) {}
|
|
96
|
+
window.top.postMessage(
|
|
97
|
+
{ action: "navigate", url: url, path: pathForItem(item) },
|
|
98
|
+
"*",
|
|
99
|
+
);
|
|
100
|
+
return false;
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function toggleItem(toggle) {
|
|
106
|
+
const item = toggle.parentElement.parentElement;
|
|
107
|
+
const expanded = item.classList.contains("collapsed");
|
|
108
|
+
|
|
109
|
+
item.classList.toggle("collapsed");
|
|
110
|
+
toggle.setAttribute("aria-expanded", expanded ? "true" : "false");
|
|
111
|
+
highlight();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function enableToggles() {
|
|
115
|
+
queryAll("#full_list a.toggle").forEach((toggle) => {
|
|
116
|
+
toggle.addEventListener("click", (event) => {
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
toggleItem(toggle);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
toggle.addEventListener("keypress", (event) => {
|
|
123
|
+
if (event.key !== "Enter") return;
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
toggleItem(toggle);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function populateSearchCache() {
|
|
132
|
+
queryAll("#full_list li .item").forEach((node) => {
|
|
133
|
+
const link = query(".object_link a", node);
|
|
134
|
+
if (!link) return;
|
|
135
|
+
|
|
136
|
+
searchCache.push({
|
|
137
|
+
node: node,
|
|
138
|
+
link: link,
|
|
139
|
+
name: link.textContent,
|
|
140
|
+
fullName: link.getAttribute("title").split(" ")[0],
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function enableSearch() {
|
|
146
|
+
const input = query("#search input");
|
|
147
|
+
const fullList = query("#full_list");
|
|
148
|
+
|
|
149
|
+
if (!input || !fullList) return;
|
|
150
|
+
|
|
151
|
+
function updateSearchResults() {
|
|
152
|
+
if (input.value === "") {
|
|
153
|
+
clearSearch();
|
|
154
|
+
} else {
|
|
155
|
+
performSearch(input.value);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
input.addEventListener("input", updateSearchResults);
|
|
160
|
+
input.addEventListener("change", updateSearchResults);
|
|
161
|
+
|
|
162
|
+
fullList.insertAdjacentHTML(
|
|
163
|
+
"afterend",
|
|
164
|
+
"<div id='noresults' role='status' style='display: none'></div>",
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function clearSearch() {
|
|
169
|
+
clearSearchTimeout();
|
|
170
|
+
queryAll("#full_list .found").forEach((node) => {
|
|
171
|
+
node.classList.remove("found");
|
|
172
|
+
});
|
|
173
|
+
query("#full_list").classList.remove("insearch");
|
|
174
|
+
query("#content").classList.remove("insearch");
|
|
175
|
+
if (clicked) {
|
|
176
|
+
let current = clicked.parentElement;
|
|
177
|
+
while (current) {
|
|
178
|
+
if (current.tagName === "LI") current.classList.remove("collapsed");
|
|
179
|
+
if (current.id === "full_list") break;
|
|
180
|
+
current = current.parentElement;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
highlight();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function performSearch(searchString) {
|
|
187
|
+
clearSearchTimeout();
|
|
188
|
+
query("#full_list").classList.add("insearch");
|
|
189
|
+
query("#content").classList.add("insearch");
|
|
190
|
+
query("#noresults").textContent = "";
|
|
191
|
+
query("#noresults").style.display = "none";
|
|
192
|
+
partialSearch(searchString, 0);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function partialSearch(searchString, offset) {
|
|
196
|
+
let lastRowClass = "";
|
|
197
|
+
let i;
|
|
198
|
+
|
|
199
|
+
for (i = offset; i < Math.min(offset + 50, searchCache.length); i += 1) {
|
|
200
|
+
const item = searchCache[i];
|
|
201
|
+
const searchName =
|
|
202
|
+
searchString.indexOf("::") !== -1 ? item.fullName : item.name;
|
|
203
|
+
const matchRegexp = new RegExp(
|
|
204
|
+
buildMatchString(searchString),
|
|
205
|
+
caseSensitiveMatch ? "" : "i",
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
if (!searchName.match(matchRegexp)) {
|
|
209
|
+
item.node.classList.remove("found");
|
|
210
|
+
} else {
|
|
211
|
+
item.node.classList.add("found");
|
|
212
|
+
if (lastRowClass) item.node.classList.remove(lastRowClass);
|
|
213
|
+
item.node.classList.add(lastRowClass === "r1" ? "r2" : "r1");
|
|
214
|
+
lastRowClass = item.node.classList.contains("r1") ? "r1" : "r2";
|
|
215
|
+
item.link.innerHTML = item.name.replace(
|
|
216
|
+
matchRegexp,
|
|
217
|
+
"<strong>$&</strong>",
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (i === searchCache.length) {
|
|
223
|
+
searchDone();
|
|
224
|
+
} else {
|
|
225
|
+
searchTimeout = setTimeout(() => {
|
|
226
|
+
partialSearch(searchString, i);
|
|
227
|
+
}, 0);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function searchDone() {
|
|
232
|
+
const found = queryAll("#full_list li").filter(isVisible).length;
|
|
233
|
+
|
|
234
|
+
searchTimeout = null;
|
|
235
|
+
highlight();
|
|
236
|
+
|
|
237
|
+
if (found === 0) {
|
|
238
|
+
query("#noresults").textContent = "No results were found.";
|
|
239
|
+
} else {
|
|
240
|
+
query("#noresults").textContent = `There are ${found} results.`;
|
|
241
|
+
}
|
|
242
|
+
query("#noresults").style.display = "block";
|
|
243
|
+
query("#content").classList.remove("insearch");
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function buildMatchString(searchString) {
|
|
247
|
+
let regexSearchString;
|
|
248
|
+
|
|
249
|
+
caseSensitiveMatch = /[A-Z]/.test(searchString);
|
|
250
|
+
regexSearchString = RegExp.escape(searchString);
|
|
251
|
+
if (caseSensitiveMatch) {
|
|
252
|
+
regexSearchString +=
|
|
253
|
+
"|" +
|
|
254
|
+
searchString
|
|
255
|
+
.split("")
|
|
256
|
+
.map((character) => RegExp.escape(character))
|
|
257
|
+
.join(".+?");
|
|
258
|
+
}
|
|
259
|
+
return regexSearchString;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function highlight() {
|
|
263
|
+
queryAll("#full_list li")
|
|
264
|
+
.filter(isVisible)
|
|
265
|
+
.forEach((item, index) => {
|
|
266
|
+
item.classList.remove("even");
|
|
267
|
+
item.classList.remove("odd");
|
|
268
|
+
item.classList.add(index % 2 === 0 ? "odd" : "even");
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function isInView(element) {
|
|
273
|
+
const rect = element.getBoundingClientRect();
|
|
274
|
+
const windowHeight =
|
|
275
|
+
window.innerHeight || document.documentElement.clientHeight;
|
|
276
|
+
return rect.left >= 0 && rect.bottom <= windowHeight;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function expandTo(path) {
|
|
280
|
+
const target = document.getElementById(`object_${path}`);
|
|
281
|
+
|
|
282
|
+
if (!target) return;
|
|
283
|
+
|
|
284
|
+
setClicked(target);
|
|
285
|
+
target.classList.remove("collapsed");
|
|
286
|
+
|
|
287
|
+
let current = target.parentElement;
|
|
288
|
+
while (current && current.id !== "full_list") {
|
|
289
|
+
if (current.tagName === "LI") current.classList.remove("collapsed");
|
|
290
|
+
current = current.parentElement;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
queryAll("a.toggle", target).forEach((toggle) => {
|
|
294
|
+
toggle.setAttribute("aria-expanded", "true");
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
current = target.parentElement;
|
|
298
|
+
while (current && current.id !== "full_list") {
|
|
299
|
+
if (current.tagName === "LI") {
|
|
300
|
+
const toggle = current.querySelector(":scope > div > a.toggle");
|
|
301
|
+
if (toggle) toggle.setAttribute("aria-expanded", "true");
|
|
302
|
+
}
|
|
303
|
+
current = current.parentElement;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
highlight();
|
|
307
|
+
|
|
308
|
+
if (!isInView(target)) {
|
|
309
|
+
window.scrollTo(
|
|
310
|
+
window.scrollX,
|
|
311
|
+
target.getBoundingClientRect().top + window.scrollY - 250,
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function windowEvents(event) {
|
|
317
|
+
const msg = event.data;
|
|
318
|
+
if (msg.action === "expand") {
|
|
319
|
+
expandTo(msg.path);
|
|
320
|
+
}
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
window.addEventListener("message", windowEvents, false);
|
|
325
|
+
|
|
326
|
+
ready(() => {
|
|
327
|
+
escapeShortcut();
|
|
328
|
+
enableLinks();
|
|
329
|
+
enableToggles();
|
|
330
|
+
populateSearchCache();
|
|
331
|
+
enableSearch();
|
|
332
|
+
highlight();
|
|
333
|
+
});
|
|
244
334
|
})();
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<% end %>
|
|
8
8
|
</title>
|
|
9
9
|
<% stylesheets.each do |stylesheet| %>
|
|
10
|
-
<link rel="stylesheet" href="<%= mtime_url(stylesheet) %>" type="text/css"
|
|
10
|
+
<link rel="stylesheet" href="<%= mtime_url(stylesheet) %>" type="text/css">
|
|
11
11
|
<% end %>
|
|
12
12
|
<%= erb :script_setup %>
|
|
13
13
|
<% javascripts.each do |javascript| %>
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
<%= erb(:headers) %>
|
|
5
5
|
</head>
|
|
6
6
|
<body>
|
|
7
|
+
<div id="main_progress" aria-hidden="true"></div>
|
|
8
|
+
|
|
7
9
|
<div class="nav_wrap">
|
|
8
10
|
<iframe id="nav" src="<%= @nav_url %>?1"></iframe>
|
|
9
11
|
<div id="resizer"></div>
|
|
@@ -21,4 +23,4 @@
|
|
|
21
23
|
<%= erb(:footer) %>
|
|
22
24
|
</div>
|
|
23
25
|
</body>
|
|
24
|
-
</html>
|
|
26
|
+
</html>
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<dl>
|
|
4
4
|
<dt class="">Defined in:</dt>
|
|
5
5
|
<dd class="">
|
|
6
|
-
<%= object.file %><% if object.files.size > 1 %><span class="defines">,<br
|
|
7
|
-
<%= object.files[1..-1].map {|f| f.first }.join(",<br
|
|
6
|
+
<%= object.file %><% if object.files.size > 1 %><span class="defines">,<br>
|
|
7
|
+
<%= object.files[1..-1].map {|f| f.first }.join(",<br> ") %></div>
|
|
8
8
|
<% end %>
|
|
9
9
|
</dd>
|
|
10
10
|
</dl>
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
<div id="method_details">
|
|
15
15
|
<%= yieldall :index => 0 %>
|
|
16
16
|
</div>
|
|
17
|
-
</div>
|
|
17
|
+
</div>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<%= object.file ? object.file : '(unknown)' %><% if object.files.size > 1 %><span class="defines">,<br
|
|
2
|
-
<%= object.files[1..-1].map {|f| f.first }.join(",<br
|
|
3
|
-
<% end %>
|
|
1
|
+
<%= object.file ? object.file : '(unknown)' %><% if object.files.size > 1 %><span class="defines">,<br>
|
|
2
|
+
<%= object.files[1..-1].map {|f| f.first }.join(",<br> ") %></span>
|
|
3
|
+
<% end %>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<% meths = prune_method_listing(superclass.meths(:included => false, :inherited => false)) %>
|
|
6
6
|
<% meths.reject! {|m| object.child(:scope => m.scope, :name => m.name) != nil } %>
|
|
7
7
|
<% meths.reject! {|m| m.is_alias? || m.is_attribute? } %>
|
|
8
|
+
<% meths.reject! {|m| m.group && object.groups && object.groups.include?(m.group) } %>
|
|
8
9
|
<% next if meths.size == 0 %>
|
|
9
10
|
<% if method_listing.size == 0 && !found_method %><h2>Method Summary</h2><% end %>
|
|
10
11
|
<% found_method = true %>
|
|
@@ -10,5 +10,13 @@
|
|
|
10
10
|
<%= yieldall :item => meth %>
|
|
11
11
|
<% end %>
|
|
12
12
|
</ul>
|
|
13
|
+
<% (inherited_methods_by_group[name] || {}).each do |superclass, meths| %>
|
|
14
|
+
<h3 class="inherited">Methods <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
|
|
15
|
+
<p class="inherited"><%= meths.sort_by {|o| o.name.to_s }.map {|m|
|
|
16
|
+
mname = m.name(true)
|
|
17
|
+
mname = mname.gsub(/^#/, '') if superclass.type == :module && object.class_mixins.include?(superclass)
|
|
18
|
+
linkify(m, mname)
|
|
19
|
+
}.join(", ") %></p>
|
|
20
|
+
<% end %>
|
|
13
21
|
<% end %>
|
|
14
22
|
<% end %>
|
|
@@ -104,6 +104,26 @@ def inherited_constant_list
|
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
def inherited_methods_by_group
|
|
108
|
+
return @inherited_meths_by_group if defined?(@inherited_meths_by_group)
|
|
109
|
+
@inherited_meths_by_group = {}
|
|
110
|
+
return @inherited_meths_by_group unless object.groups
|
|
111
|
+
|
|
112
|
+
object.inheritance_tree(true)[1..-1].each do |superclass|
|
|
113
|
+
next if superclass.is_a?(YARD::CodeObjects::Proxy)
|
|
114
|
+
next if options.embed_mixins.size > 0 && options.embed_mixins_match?(superclass) != false
|
|
115
|
+
meths = prune_method_listing(superclass.meths(:included => false, :inherited => false))
|
|
116
|
+
meths.reject! {|m| object.child(:scope => m.scope, :name => m.name) != nil }
|
|
117
|
+
meths.reject! {|m| m.is_alias? || m.is_attribute? }
|
|
118
|
+
meths.each do |m|
|
|
119
|
+
next unless m.group && object.groups.include?(m.group)
|
|
120
|
+
(@inherited_meths_by_group[m.group] ||= {})[superclass] ||= []
|
|
121
|
+
@inherited_meths_by_group[m.group][superclass] << m
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
@inherited_meths_by_group
|
|
125
|
+
end
|
|
126
|
+
|
|
107
127
|
def docstring_full(obj)
|
|
108
128
|
docstring = obj.tags(:overload).size == 1 && obj.docstring.empty? ?
|
|
109
129
|
obj.tag(:overload).docstring : obj.docstring
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
<!DOCTYPE html
|
|
2
|
-
|
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
4
3
|
<head>
|
|
5
|
-
<meta
|
|
4
|
+
<meta charset="<%= charset %>">
|
|
6
5
|
<title><%= defined?(@title) ? @title : '' %></title>
|
|
7
6
|
<%= erb(:headers) %>
|
|
8
7
|
</head>
|