rdoc 7.0.0 → 7.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09f66eb1c281e4323e70183c119a58a9c97c8fef86ba4f1ae42691d614a484be'
4
- data.tar.gz: eb7605a8633beab318d2bc9ee4fb66c420397a3ab48bdd5ef8c9d4c533c12ffc
3
+ metadata.gz: e4554f502b1e5285ff99533998dcd2d234b6baa2523c8cba370cc01a1cbda0ed
4
+ data.tar.gz: e43dd25c7f053ff9d7961ce8f3e909cfac96630f0423acfcd7e79273face142b
5
5
  SHA512:
6
- metadata.gz: 722cd4f102ad66df12a9db58c4807545a1d489090f7e82b9d3b84422a82975c7e20dc32c263fd6ae1c5c5421e9d65a599e1dce70431dc963991292bf328f0990
7
- data.tar.gz: 328b307c3ae2fd5057e40afa1f0e72da247f455aab4427698f15d51606aa469097f4816a607a518087f8284270822d8de9b30af86720c87011e1cc78b25121b0
6
+ metadata.gz: 8671e63c809b9dad72fdeb59e826e8957607997544e589cbbc14f76d803ed20781f51b4d89dba71070c2b6a87cba263967fe808e64c639467361585bacaacdd0
7
+ data.tar.gz: 826f81bfe0cf97176f2e2320980ed2f781723023642575092ffa3651b00fe232a922cef6aeecdb1f567a46d3cfb2e4d27afec9ed483d519f4e569228fe0d43fb
@@ -807,11 +807,13 @@ class RDoc::ClassModule < RDoc::Context
807
807
  cm_alias = cm.dup
808
808
  cm_alias.name = const.name
809
809
 
810
- # Don't move top-level aliases under Object, they look ugly there
811
- unless RDoc::TopLevel === cm_alias.parent then
810
+ if full_name == 'Object'
811
+ # Don't move top-level aliases under Object, they look ugly there
812
+ cm_alias.parent = top_level
813
+ else
812
814
  cm_alias.parent = self
813
- cm_alias.full_name = nil # force update for new parent
814
815
  end
816
+ cm_alias.full_name = nil # force update for new parent
815
817
 
816
818
  cm_alias.aliases.clear
817
819
  cm_alias.is_alias_for = cm
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'uri'
4
+
3
5
  ##
4
6
  # Aliki theme for RDoc documentation
5
7
  #
@@ -115,6 +117,21 @@ class RDoc::Generator::Aliki < RDoc::Generator::Darkfish
115
117
  File.write search_index_path, "var search_data = #{JSON.generate(data)};"
116
118
  end
117
119
 
120
+ ##
121
+ # Resolves a URL for use in templates. Absolute URLs are returned unchanged.
122
+ # Relative URLs are prefixed with rel_prefix to ensure they resolve correctly from any page.
123
+
124
+ def resolve_url(rel_prefix, url)
125
+ uri = URI.parse(url)
126
+ if uri.absolute?
127
+ url
128
+ else
129
+ "#{rel_prefix}/#{url}"
130
+ end
131
+ rescue URI::InvalidURIError
132
+ "#{rel_prefix}/#{url}"
133
+ end
134
+
118
135
  private
119
136
 
120
137
  def build_class_module_entry(klass)
@@ -356,7 +356,9 @@ class RDoc::Generator::Darkfish
356
356
 
357
357
  current = nil
358
358
 
359
- @classes.each do |klass|
359
+ # Document files are generated only for non-alias classes/modules
360
+ @classes.reject(&:is_alias_for).each do |klass|
361
+
360
362
  current = klass
361
363
 
362
364
  generate_class klass, template_file
@@ -6,7 +6,7 @@
6
6
  <h3><%= h column_title %></h3>
7
7
  <ul>
8
8
  <% links.each do |text, url| %>
9
- <li><a href="<%= h url %>"><%= h text %></a></li>
9
+ <li><a href="<%= h resolve_url(rel_prefix, url) %>"><%= h text %></a></li>
10
10
  <% end %>
11
11
  </ul>
12
12
  </div>
@@ -7,13 +7,13 @@
7
7
  <div class="navbar-search navbar-search-desktop" role="search">
8
8
  <form action="#" method="get" accept-charset="utf-8">
9
9
  <input id="search-field" role="combobox" aria-label="Search"
10
- aria-autocomplete="list" aria-controls="search-results"
10
+ aria-autocomplete="list" aria-controls="search-results-desktop"
11
11
  type="text" name="search" placeholder="Search (/) for a class, method..."
12
12
  spellcheck="false" autocomplete="off"
13
13
  title="Type to search, Up and Down to navigate, Enter to load">
14
- <ul id="search-results" aria-label="Search Results"
14
+ <ul id="search-results-desktop" aria-label="Search Results"
15
15
  aria-busy="false" aria-expanded="false"
16
- aria-atomic="false" class="initially-hidden"></ul>
16
+ aria-atomic="false" class="initially-hidden search-results"></ul>
17
17
  </form>
18
18
  </div>
19
19
 
@@ -47,7 +47,7 @@
47
47
  <div class="search-modal-body">
48
48
  <ul id="search-results-mobile" aria-label="Search Results"
49
49
  aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="search-modal-results initially-hidden"></ul>
50
+ aria-atomic="false" class="search-results search-modal-results initially-hidden"></ul>
51
51
  <div class="search-modal-empty">
52
52
  <p>No recent searches</p>
53
53
  </div>
@@ -2,14 +2,14 @@
2
2
  <form action="#" method="get" accept-charset="utf-8">
3
3
  <div id="search-field-wrapper">
4
4
  <input id="search-field" role="combobox" aria-label="Search"
5
- aria-autocomplete="list" aria-controls="search-results"
5
+ aria-autocomplete="list" aria-controls="search-results-desktop"
6
6
  type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
7
7
  autocomplete="off"
8
8
  title="Type to search, Up and Down to navigate, Enter to load">
9
9
  </div>
10
10
 
11
- <ul id="search-results" aria-label="Search Results"
11
+ <ul id="search-results-desktop" aria-label="Search Results"
12
12
  aria-busy="false" aria-expanded="false"
13
- aria-atomic="false" class="initially-hidden"></ul>
13
+ aria-atomic="false" class="initially-hidden search-results"></ul>
14
14
  </form>
15
15
  </div>
@@ -3,7 +3,7 @@
3
3
  <%= render '_header.rhtml' %>
4
4
  <%= render '_sidebar_toggle.rhtml' %>
5
5
 
6
- <nav id="navigation" role="navigation">
6
+ <nav id="navigation" role="navigation" hidden>
7
7
  <%= render '_sidebar_pages.rhtml' %>
8
8
  <%= render '_sidebar_sections.rhtml' %>
9
9
  <%= render '_sidebar_ancestors.rhtml' %>
@@ -110,10 +110,10 @@
110
110
  </section>
111
111
  <%- end %>
112
112
 
113
- <%- klass.methods_by_type(section).each do |type, visibilities|
114
- next if visibilities.empty?
115
- visibilities.each do |visibility, methods|
116
- next if methods.empty? %>
113
+ <%- klass.methods_by_type(section).each do |type, visibilities| %>
114
+ <%- next if visibilities.empty? %>
115
+ <%- visibilities.each do |visibility, methods| %>
116
+ <%- next if methods.empty? %>
117
117
  <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section anchor-link">
118
118
  <header>
119
119
  <h3 id="<%= visibility %>-<%= type %>-methods"><a href="#<%= visibility %>-<%= type %>-methods"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</a></h3>
@@ -206,8 +206,8 @@
206
206
 
207
207
  <%- end %>
208
208
  </section>
209
- <%- end
210
- end %>
209
+ <%- end %>
210
+ <%- end %>
211
211
  </section>
212
212
  <%- end %>
213
213
  </main>
@@ -690,7 +690,6 @@ nav ul li {
690
690
  }
691
691
 
692
692
  nav ul li a {
693
- padding: var(--space-1) 0;
694
693
  transition:
695
694
  color var(--transition-fast),
696
695
  transform var(--transition-fast),
@@ -1811,50 +1810,50 @@ footer.site-footer .footer-bottom:first-child {
1811
1810
  }
1812
1811
 
1813
1812
  /* Search Results */
1814
- #search-results {
1813
+ .search-results {
1815
1814
  font-family: var(--font-primary);
1816
1815
  font-weight: 300;
1817
1816
  }
1818
1817
 
1819
- #search-results a {
1818
+ .search-results a {
1820
1819
  color: var(--color-text-primary);
1821
1820
  }
1822
1821
 
1823
- #search-results a:hover {
1822
+ .search-results a:hover {
1824
1823
  color: var(--color-accent-primary);
1825
1824
  }
1826
1825
 
1827
- #search-results .search-match {
1826
+ .search-results .search-match {
1828
1827
  font-family: var(--font-heading);
1829
1828
  font-weight: normal;
1830
1829
  }
1831
1830
 
1832
- #search-results .search-selected {
1831
+ .search-results .search-selected {
1833
1832
  background: var(--color-code-bg);
1834
1833
  border-bottom: 1px solid transparent;
1835
1834
  }
1836
1835
 
1837
- #search-results li {
1836
+ .search-results li {
1838
1837
  list-style: none;
1839
1838
  border-bottom: 1px solid var(--color-border-default);
1840
1839
  margin-bottom: 0.5em;
1841
1840
  }
1842
1841
 
1843
- #search-results li:last-child {
1842
+ .search-results li:last-child {
1844
1843
  border-bottom: none;
1845
1844
  margin-bottom: 0;
1846
1845
  }
1847
1846
 
1848
- #search-results li p {
1847
+ .search-results li p {
1849
1848
  padding: 0;
1850
1849
  margin: 0.5em;
1851
1850
  }
1852
1851
 
1853
- #search-results .search-namespace {
1852
+ .search-results .search-namespace {
1854
1853
  font-weight: bold;
1855
1854
  }
1856
1855
 
1857
- #search-results .search-type {
1856
+ .search-results .search-type {
1858
1857
  display: inline-block;
1859
1858
  margin-left: var(--space-2);
1860
1859
  padding: 0 var(--space-2);
@@ -1866,33 +1865,33 @@ footer.site-footer .footer-bottom:first-child {
1866
1865
  color: var(--color-text-secondary);
1867
1866
  }
1868
1867
 
1869
- #search-results .search-type-class {
1868
+ .search-results .search-type-class {
1870
1869
  background: var(--color-search-type-class-bg);
1871
1870
  color: var(--color-search-type-class-text);
1872
1871
  }
1873
1872
 
1874
- #search-results .search-type-module {
1873
+ .search-results .search-type-module {
1875
1874
  background: var(--color-search-type-module-bg);
1876
1875
  color: var(--color-search-type-module-text);
1877
1876
  }
1878
1877
 
1879
- #search-results .search-type-constant {
1878
+ .search-results .search-type-constant {
1880
1879
  background: var(--color-search-type-constant-bg);
1881
1880
  color: var(--color-search-type-constant-text);
1882
1881
  }
1883
1882
 
1884
- #search-results .search-type-instance-method,
1885
- #search-results .search-type-class-method {
1883
+ .search-results .search-type-instance-method,
1884
+ .search-results .search-type-class-method {
1886
1885
  background: var(--color-search-type-method-bg);
1887
1886
  color: var(--color-search-type-method-text);
1888
1887
  }
1889
1888
 
1890
- #search-results li em {
1889
+ .search-results li em {
1891
1890
  background-color: var(--color-search-highlight-bg);
1892
1891
  font-style: normal;
1893
1892
  }
1894
1893
 
1895
- #search-results pre {
1894
+ .search-results pre {
1896
1895
  margin: 0.5em;
1897
1896
  font-family: var(--font-code);
1898
1897
  }
@@ -1919,7 +1918,7 @@ header.top-navbar #search-field::placeholder {
1919
1918
  }
1920
1919
 
1921
1920
  /* Search results dropdown in navbar */
1922
- header.top-navbar #search-results {
1921
+ header.top-navbar #search-results-desktop {
1923
1922
  position: absolute;
1924
1923
  top: calc(100% + var(--space-2));
1925
1924
  left: 0;
@@ -1935,10 +1934,10 @@ header.top-navbar #search-results {
1935
1934
  padding: 0;
1936
1935
  }
1937
1936
 
1938
- header.top-navbar #search-results.initially-hidden {
1937
+ header.top-navbar #search-results-desktop.initially-hidden {
1939
1938
  display: none;
1940
1939
  }
1941
1940
 
1942
- header.top-navbar #search-results[aria-expanded="false"] {
1941
+ header.top-navbar #search-results-desktop[aria-expanded="false"] {
1943
1942
  display: none;
1944
1943
  }
@@ -3,7 +3,7 @@
3
3
  <%= render '_header.rhtml' %>
4
4
  <%= render '_sidebar_toggle.rhtml' %>
5
5
 
6
- <nav id="navigation" role="navigation">
6
+ <nav id="navigation" role="navigation" hidden>
7
7
  <%= render '_sidebar_pages.rhtml' %>
8
8
  <%= render '_sidebar_classes.rhtml' %>
9
9
  </nav>
@@ -67,15 +67,7 @@ function createSearchInstance(input, result) {
67
67
  }
68
68
 
69
69
  search.select = function(result) {
70
- let href = result.firstChild.firstChild.href;
71
- const query = this.input.value;
72
- if (query) {
73
- const url = new URL(href, window.location.origin);
74
- url.searchParams.set('q', query);
75
- url.searchParams.set('nav', '0');
76
- href = url.toString();
77
- }
78
- window.location.href = href;
70
+ window.location.href = result.firstChild.firstChild.href;
79
71
  }
80
72
 
81
73
  search.scrollIntoView = search.scrollInWindow;
@@ -85,7 +77,7 @@ function createSearchInstance(input, result) {
85
77
 
86
78
  function hookSearch() {
87
79
  const input = document.querySelector('#search-field');
88
- const result = document.querySelector('#search-results');
80
+ const result = document.querySelector('#search-results-desktop');
89
81
 
90
82
  if (!input || !result) return; // Exit if search elements not found
91
83
 
@@ -97,15 +89,27 @@ function hookSearch() {
97
89
  const search = createSearchInstance(input, result);
98
90
  if (!search) return;
99
91
 
92
+ // Hide search results when clicking outside the search area
93
+ document.addEventListener('click', (e) => {
94
+ if (!e.target.closest('.navbar-search-desktop')) {
95
+ search.hide();
96
+ }
97
+ });
98
+
99
+ // Show search results when focusing on input (if there's a query)
100
+ input.addEventListener('focus', () => {
101
+ if (input.value.trim()) {
102
+ search.show();
103
+ }
104
+ });
105
+
100
106
  // Check for ?q= URL parameter and trigger search automatically
101
107
  if (typeof URLSearchParams !== 'undefined') {
102
108
  const urlParams = new URLSearchParams(window.location.search);
103
109
  const queryParam = urlParams.get('q');
104
110
  if (queryParam) {
105
- const navParam = urlParams.get('nav');
106
- const autoSelect = navParam !== '0';
107
111
  input.value = queryParam;
108
- search.search(queryParam, autoSelect);
112
+ search.search(queryParam, false);
109
113
  }
110
114
  }
111
115
  }
@@ -158,9 +162,12 @@ function hookSidebar() {
158
162
  });
159
163
 
160
164
  const isSmallViewport = window.matchMedia("(max-width: 1023px)").matches;
161
- if (isSmallViewport) {
162
- closeNav();
163
165
 
166
+ // The sidebar is hidden by default with the `hidden` attribute
167
+ // On large viewports, we display the sidebar with JavaScript
168
+ // This is better than the opposite approach of hiding it with JavaScript
169
+ // because it avoids flickering the sidebar when the page is loaded, especially on mobile devices
170
+ if (isSmallViewport) {
164
171
  // Close nav when clicking links inside it
165
172
  document.addEventListener('click', (e) => {
166
173
  if (e.target.closest('#navigation a')) {
@@ -176,6 +183,8 @@ function hookSidebar() {
176
183
  closeNav();
177
184
  }
178
185
  });
186
+ } else {
187
+ openNav();
179
188
  }
180
189
  }
181
190
 
@@ -378,9 +387,7 @@ function hookSearchModal() {
378
387
  if (queryParam && isSmallViewport) {
379
388
  openSearchModal();
380
389
  searchInput.value = queryParam;
381
- const navParam = urlParams.get('nav');
382
- const autoSelect = navParam !== '0';
383
- mobileSearch.search(queryParam, autoSelect);
390
+ mobileSearch.search(queryParam, false);
384
391
  }
385
392
  }
386
393
  }
@@ -116,5 +116,14 @@ SearchController.prototype = Object.assign({}, SearchNavigation, new function()
116
116
  });
117
117
  }
118
118
 
119
+ this.hide = function() {
120
+ this.result.setAttribute('aria-expanded', 'false');
121
+ this.setNavigationActive(false);
122
+ }
123
+
124
+ this.show = function() {
125
+ this.result.setAttribute('aria-expanded', 'true');
126
+ this.setNavigationActive(true);
127
+ }
119
128
  });
120
129
 
@@ -3,7 +3,7 @@
3
3
  <%= render '_header.rhtml' %>
4
4
  <%= render '_sidebar_toggle.rhtml' %>
5
5
 
6
- <nav id="navigation" role="navigation">
6
+ <nav id="navigation" role="navigation" hidden>
7
7
  <%= render '_sidebar_pages.rhtml' %>
8
8
  <%= render '_sidebar_classes.rhtml' %>
9
9
  </nav>
@@ -1,7 +1,7 @@
1
1
  <body role="document">
2
2
  <%= render '_sidebar_toggle.rhtml' %>
3
3
 
4
- <nav id="navigation" role="navigation">
4
+ <nav id="navigation" role="navigation" hidden>
5
5
  <%= render '_sidebar_pages.rhtml' %>
6
6
  <%= render '_sidebar_classes.rhtml' %>
7
7
  </nav>
@@ -1,7 +1,7 @@
1
1
  <body role="document">
2
2
  <%= render '_sidebar_toggle.rhtml' %>
3
3
 
4
- <nav id="navigation" role="navigation">
4
+ <nav id="navigation" role="navigation" hidden>
5
5
  <div id="project-navigation">
6
6
  <div id="home-section" class="nav-section">
7
7
  <h2>
@@ -117,10 +117,10 @@
117
117
  </section>
118
118
  <%- end %>
119
119
 
120
- <%- klass.methods_by_type(section).each do |type, visibilities|
121
- next if visibilities.empty?
122
- visibilities.each do |visibility, methods|
123
- next if methods.empty? %>
120
+ <%- klass.methods_by_type(section).each do |type, visibilities| %>
121
+ <%- next if visibilities.empty? %>
122
+ <%- visibilities.each do |visibility, methods| %>
123
+ <%- next if methods.empty? %>
124
124
  <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section anchor-link">
125
125
  <header>
126
126
  <h3><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
@@ -213,8 +213,8 @@
213
213
 
214
214
  <%- end %>
215
215
  </section>
216
- <%- end
217
- end %>
216
+ <%- end %>
217
+ <%- end %>
218
218
  </section>
219
219
  <%- end %>
220
220
  </main>
data/lib/rdoc/version.rb CHANGED
@@ -5,6 +5,6 @@ module RDoc
5
5
  ##
6
6
  # RDoc version you are using
7
7
 
8
- VERSION = '7.0.0'
8
+ VERSION = '7.0.2'
9
9
 
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -13,7 +13,7 @@ authors:
13
13
  - ITOYANAGI Sakura
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2025-12-18 00:00:00.000000000 Z
16
+ date: 2025-12-22 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: psych