yard 0.9.36 → 0.9.37

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.
@@ -62,8 +62,25 @@ function enableToggles() {
62
62
  evt.stopPropagation();
63
63
  evt.preventDefault();
64
64
  $(this).parent().parent().toggleClass('collapsed');
65
+ $(this).attr('aria-expanded', function (i, attr) {
66
+ return attr == 'true' ? 'false' : 'true'
67
+ });
65
68
  highlight();
66
69
  });
70
+
71
+ // navigation of nested classes using keyboard
72
+ $('#full_list a.toggle').on('keypress',function(evt) {
73
+ // enter key is pressed
74
+ if (evt.which == 13) {
75
+ evt.stopPropagation();
76
+ evt.preventDefault();
77
+ $(this).parent().parent().toggleClass('collapsed');
78
+ $(this).attr('aria-expanded', function (i, attr) {
79
+ return attr == 'true' ? 'false' : 'true'
80
+ });
81
+ highlight();
82
+ }
83
+ });
67
84
  }
68
85
 
69
86
  function populateSearchCache() {
@@ -91,7 +108,7 @@ function enableSearch() {
91
108
  }
92
109
  });
93
110
 
94
- $('#full_list').after("<div id='noresults' style='display:none'></div>");
111
+ $('#full_list').after("<div id='noresults' role='status' style='display: none'></div>");
95
112
  }
96
113
 
97
114
  function ignoredKeyPress(event) {
@@ -154,11 +171,14 @@ function partialSearch(searchString, offset) {
154
171
  function searchDone() {
155
172
  searchTimeout = null;
156
173
  highlight();
157
- if ($('#full_list li:visible').size() === 0) {
158
- $('#noresults').text('No results were found.').hide().fadeIn();
174
+ var found = $('#full_list li:visible').size();
175
+ if (found === 0) {
176
+ $('#noresults').text('No results were found.');
159
177
  } else {
160
- $('#noresults').text('').hide();
178
+ // This is read out to screen readers
179
+ $('#noresults').text('There are ' + found + ' results.');
161
180
  }
181
+ $('#noresults').show();
162
182
  $('#content').removeClass('insearch');
163
183
  }
164
184
 
@@ -188,6 +208,12 @@ function expandTo(path) {
188
208
  $target.addClass('clicked');
189
209
  $target.removeClass('collapsed');
190
210
  $target.parentsUntil('#full_list', 'li').removeClass('collapsed');
211
+
212
+ $target.find('a.toggle').attr('aria-expanded', 'true')
213
+ $target.parentsUntil('#full_list', 'li').each(function(i, el) {
214
+ $(el).find('> div > a.toggle').attr('aria-expanded', 'true');
215
+ });
216
+
191
217
  if($target[0]) {
192
218
  window.scrollTo(window.scrollX, $target.offset().top - 250);
193
219
  highlight();
@@ -104,6 +104,12 @@ def javascripts_full_list
104
104
  %w(js/jquery.js js/full_list.js)
105
105
  end
106
106
 
107
+ # Sets the HTML language lang="value" where value is the value returned from
108
+ # this method. Defaults to nil which does not set the lang attribute.
109
+ def html_lang
110
+ nil
111
+ end
112
+
107
113
  def menu_lists
108
114
  Object.new.extend(T('layout')).menu_lists
109
115
  end
@@ -225,7 +231,8 @@ def class_list(root = Registry.root, tree = TreeContext.new)
225
231
  has_children = run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
226
232
  out << "<li id='object_#{child.path}' class='#{tree.classes.join(' ')}'>"
227
233
  out << "<div class='item' style='padding-left:#{tree.indent}'>"
228
- out << "<a class='toggle'></a> " if has_children
234
+ accessible_props = "aria-label='#{name} child nodes' aria-expanded='false' aria-controls='object_#{child.path}'"
235
+ out << "<a tabindex='0' class='toggle' role='button' #{accessible_props}></a> " if has_children
229
236
  out << linkify(child, name)
230
237
  out << " &lt; #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass
231
238
  out << "<small class='search_info'>"
@@ -233,7 +240,8 @@ def class_list(root = Registry.root, tree = TreeContext.new)
233
240
  out << "</small>"
234
241
  out << "</div>"
235
242
  tree.nest do
236
- out << "<ul>#{class_list(child, tree)}</ul>" if has_children
243
+ labeled_by = "aria-labelledby='object_#{child.path}'"
244
+ out << "<div #{labeled_by}><ul>#{class_list(child, tree)}</ul></div>" if has_children
237
245
  end
238
246
  out << "</li>"
239
247
  end
@@ -1,5 +1,7 @@
1
1
  <style type="text/css">
2
2
  <%= @css_data %>
3
+ html { width: auto; height: auto; }
4
+ body { display: block; margin: 1rem; width: auto; }
3
5
  </style>
4
6
  <script type="text/javascript">
5
7
  <%= @js_data %>
@@ -1,9 +1,9 @@
1
1
  <% if object.has_tag?(:example) %>
2
2
  <div class="examples">
3
- <p class="tag_title">Examples:</p>
3
+ <h4 class="tag_title">Examples:</h4>
4
4
  <% object.tags(:example).each do |tag| %>
5
5
  <% unless tag.name.empty? %>
6
- <p class="example_title"><%= htmlify_line(tag.name) %></p>
6
+ <h5 class="example_title"><%= htmlify_line(tag.name) %></h5>
7
7
  <% end %>
8
8
  <pre class="example code"><code><%= html_syntax_highlight(tag.text) %></code></pre>
9
9
  <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.36
4
+ version: 0.9.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Segal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-09-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  YARD is a documentation generation tool for the Ruby programming language.
@@ -165,6 +165,7 @@ files:
165
165
  - lib/yard/i18n/pot_generator.rb
166
166
  - lib/yard/i18n/text.rb
167
167
  - lib/yard/logging.rb
168
+ - lib/yard/open_struct.rb
168
169
  - lib/yard/options.rb
169
170
  - lib/yard/parser/base.rb
170
171
  - lib/yard/parser/c/c_parser.rb