Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New theme? #1182

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
3932a65
wip
antoinem Aug 29, 2024
4758120
rorvswild template wip
antoinem Aug 30, 2024
cdc4875
adapt gh-pages action
antoinem Aug 30, 2024
81f0262
improve module style
antoinem Aug 31, 2024
7fc61db
edit gh action
antoinem Aug 31, 2024
83b9ca7
edit gh action
antoinem Aug 31, 2024
863fe56
edit gh action
antoinem Aug 31, 2024
e9bb47d
edit gh action
antoinem Aug 31, 2024
8478dc0
edit gh action
antoinem Aug 31, 2024
c039b09
Switch rdoc task to rorvswidl template
alexisbernard Sep 2, 2024
17dce09
Update action
alexisbernard Sep 2, 2024
8229ad2
Fix sidebar pages
alexisbernard Sep 2, 2024
8b1e471
Add action to build and deploy Ruby docs
alexisbernard Sep 2, 2024
92529d0
update title and links style
antoinem Sep 4, 2024
44e8d34
darkmode, css cleanup
antoinem Sep 4, 2024
d8aa7ab
modify layout to limit content width
antoinem Sep 4, 2024
ccca32d
local inter font
antoinem Sep 4, 2024
99b9884
fix list style
antoinem Sep 5, 2024
23c4706
style fix
antoinem Sep 5, 2024
b83fab4
fix page
antoinem Sep 5, 2024
585747f
add nav active class
antoinem Sep 6, 2024
d534196
improve classes sîdebar
antoinem Sep 6, 2024
0b4993a
add scrollspy script to highlight contextual nav sidebar link
antoinem Sep 6, 2024
d06a355
update scrollspy to highlight all visible elements
antoinem Sep 7, 2024
7854515
typography
antoinem Sep 7, 2024
189da82
add toc on index
antoinem Sep 9, 2024
2b2ae20
left navigation partial
antoinem Sep 11, 2024
bd6a5a1
Set Ruby doc title
alexisbernard Sep 12, 2024
c71c0db
improve responsive layout
antoinem Sep 12, 2024
15110c5
Scroll to active left sidebar item
alexisbernard Sep 12, 2024
cce3487
Merge branch 'update_style' into ruby-docs
alexisbernard Sep 12, 2024
cca0218
Split nav between class and instance methods
alexisbernard Sep 12, 2024
28f3c6f
method sidebar markup
antoinem Sep 12, 2024
c508119
adjust spacing
antoinem Sep 12, 2024
e21e405
adjust scroll padding
antoinem Sep 12, 2024
2dc4d17
Add cname ruby.rorvswild.com
alexisbernard Sep 12, 2024
0d93d80
Remove RorVsWild generator
alexisbernard Sep 13, 2024
7a0b48b
search in topbar
antoinem Sep 13, 2024
db43c8d
delete images, inline svg for search icon
antoinem Sep 13, 2024
ddee5db
h align sidebar
antoinem Sep 13, 2024
7fc5d8c
footer credit
antoinem Sep 13, 2024
32609cb
nav summary alignment
antoinem Sep 13, 2024
8842d17
nav summary alignment
antoinem Sep 13, 2024
7077847
nav summary alignment
antoinem Sep 13, 2024
724c1fb
Do not prefix class and instance methods with double colon or a hash
alexisbernard Sep 13, 2024
1f86544
search dialog with fixed search field
antoinem Sep 14, 2024
cf2067f
adjust style for pre in search dialog
antoinem Sep 14, 2024
a392e29
List class ancestors
alexisbernard Sep 14, 2024
3dade77
move toggle source, remove link to top
antoinem Sep 14, 2024
63dd2bd
fix test?
antoinem Sep 14, 2024
efd3430
toggle source spacing
antoinem Sep 14, 2024
720ce6d
top is back
antoinem Sep 14, 2024
653e59f
fix ancestors list spacing
antoinem Sep 14, 2024
329c83f
Collapse ancestors
alexisbernard Sep 16, 2024
00eb35b
List constants in right sidebar
alexisbernard Sep 16, 2024
e609304
break long word in sidebar
antoinem Sep 25, 2024
69a722f
delete CNAME
antoinem Sep 25, 2024
6f1d5a6
Close li
alexisbernard Sep 17, 2024
2b3d792
Merge branch 'master' into ruby-docs
alexisbernard Sep 30, 2024
5540f8b
Rename branch
alexisbernard Sep 30, 2024
8985517
Undo fix heading levels in documentation
antoinem Sep 30, 2024
277967b
remove outdated css comments
antoinem Sep 30, 2024
2e4f920
Update darkfish theme, delete rorvswild theme folder
antoinem Oct 7, 2024
2fb97c3
Merge branch 'master' into rorvswild_theme
antoinem Oct 7, 2024
7d7652a
Remove reference to rorvswild in Rakefile
antoinem Oct 7, 2024
d1687d9
Undo TODO.rdoc changes
antoinem Oct 7, 2024
077c177
Merge branch 'master' into rorvswild_theme
antoinem Oct 7, 2024
5b9b3a3
Fix calling sidebar_table_of_content template
alexisbernard Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/ruby-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy Ruby docs to Pages

on:
push:
branches: [ 'rorvswild_theme' ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.repository == 'basesecrete/rdoc' && !startsWith(github.event_name, 'pull') }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout Ruby
uses: actions/checkout@v4
with:
repository: ruby/ruby
path: ruby

- name: Setup Ruby
uses: ruby/setup-ruby@161cd54b698f1fb3ea539faab2e036d409550e3c # v1.187.0
with:
ruby-version: '3.2'
bundler-cache: true

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Build with RDoc
run: |
bundle
bundle exec rake generate
bundle exec rdoc --root=ruby --include=ruby/doc --title "Ruby Documentation" --main=README.md --template=rorvswild --debug

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
10 changes: 10 additions & 0 deletions lib/rdoc/code_object/class_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,16 @@ def superclass=(superclass)
@superclass = superclass
end

def super_classes
result = []
parent = self
while parent = parent.superclass
result << parent
return result if parent.is_a?(String)
end
result
end

def to_s # :nodoc:
if is_alias_for then
"#{self.class.name} #{self.full_name} -> #{is_alias_for}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div id="search-section" role="search" class="project-section initially-hidden">
<dialog id="search-dialog" role="search" class="search-dialog initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<div id="search-field-wrapper">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
<input id="search-field" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results"
type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
Expand All @@ -9,6 +10,7 @@

<ul id="search-results" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
aria-atomic="false" class="initially-hidden"></ul>
aria-atomic="false" class="initially-hidden">
</ul>
</form>
</div>
</dialog>
9 changes: 4 additions & 5 deletions lib/rdoc/generator/template/darkfish/_footer.rhtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> <%= RDoc::VERSION %>.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>
<footer role="contentinfo">
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> <%= RDoc::VERSION %>. <a href="https://validator.w3.org/check/referer">Validate</a>.
<p><a href="http://rorvswild.com/theme">RoRvsWild theme</a> based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a>.
</footer>
5 changes: 5 additions & 0 deletions lib/rdoc/generator/template/darkfish/_navigation.rhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<nav id="navigation" role="navigation">
<%= render '_sidebar_classes.rhtml' %>
<%= render '_sidebar_pages.rhtml' %>
<%= render '_footer.rhtml' %>
</nav>
33 changes: 24 additions & 9 deletions lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="classindex-section" class="nav-section">
<div class="nav-section">
<h3>Class and Module Index</h3>

<%-
Expand All @@ -9,22 +9,37 @@
end
link = proc do |index_klass, display = index_klass.display?|
if display
-%><code><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.name %></a></code><%-
-%><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.name %></a><%-
else
-%><code><%= index_klass.name %></code><%-
-%><%= index_klass.name %><%-
end
end

def has_active_descendant?(klass, current, all_classes)
return false unless defined?(current)
return true if klass == current
children = all_classes[klass.full_name]
return false unless children
children.any? { |child| has_active_descendant?(child, current, all_classes) }
end

if top = all_classes[nil]
solo = top.one? {|klass| klass.display?}
traverse = proc do |klasses| -%>
<ul class="link-list">
traverse = proc do |klasses|
has_active_descendant = false
-%>
<ul class="link-list" id="class-and-module-index">
<%- klasses.each do |index_klass| -%>
<%- if children = all_classes[index_klass.full_name] -%>
<li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary>
<%- traverse.call(children) -%>
</ul></details>
<li class="<%= "active" if defined?(current) && (index_klass == current) %>">
<details<% if solo || (defined?(current) && has_active_descendant?(index_klass, current, all_classes)); solo = false %> open<% end %>>
<summary><% link.call(index_klass) %></summary>
<%- traverse.call(children) -%>
</ul>
</details>
<%- elsif index_klass.display? -%>
<li><% link.call(index_klass, true) %>
<li class="<%= "active" if defined?(current) && (index_klass == current) %>">
<% link.call(index_klass, true) %>
<%- end -%>
<%- end -%>
<%- end -%>
Expand Down
10 changes: 10 additions & 0 deletions lib/rdoc/generator/template/darkfish/_sidebar_constants.rhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% if (constants = klass.constants.sort).any? %>
<div class="nav-section">
<h3>Constants</h3>
<ul class="link-list" role="directory">
<%- constants.each do |const| -%>
<li><a href="#<%= h const.name %>"><%= h const.name -%></a></li>
<%- end -%>
</ul>
</div>
<% end %>
24 changes: 12 additions & 12 deletions lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<%- unless klass.extends.empty? then %>
<div id="extends-section" class="nav-section">
<h3>Extended With Modules</h3>
<div class="nav-section">
<h3>Extended With Modules</h3>

<ul class="link-list">
<%- klass.each_extend do |ext| -%>
<%- unless String === ext.module then -%>
<li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
<%- else -%>
<li><span class="extend"><%= ext.name %></span>
<%- end -%>
<%- end -%>
</ul>
</div>
<ul class="link-list">
<%- klass.each_extend do |ext| -%>
<%- unless String === ext.module then -%>
<li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
<%- else -%>
<li><span class="extend"><%= ext.name %></span>
<%- end -%>
<%- end -%>
</ul>
</div>
<%- end -%>
7 changes: 3 additions & 4 deletions lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<div id="file-list-section" class="nav-section">
<h3>Defined In</h3>

<ul>
<%- klass.in_files.each do |tl| -%>
<li><%= h tl.relative_name %>
<%- end -%>
<%- klass.in_files.each do |tl| -%>
<li><%= h tl.relative_name %>
<%- end -%>
</ul>
</div>
24 changes: 12 additions & 12 deletions lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<%- unless klass.includes.empty? then %>
<div id="includes-section" class="nav-section">
<h3>Included Modules</h3>
<div class="nav-section">
<h3>Included Modules</h3>

<ul class="link-list">
<%- klass.each_include do |inc| -%>
<%- unless String === inc.module then -%>
<li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
<%- else -%>
<li><span class="include"><%= inc.name %></span>
<%- end -%>
<%- end -%>
</ul>
</div>
<ul class="link-list">
<%- klass.each_include do |inc| -%>
<%- unless String === inc.module then -%>
<li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
<%- else -%>
<li><span class="include"><%= inc.name %></span>
<%- end -%>
<%- end -%>
</ul>
</div>
<%- end -%>
31 changes: 20 additions & 11 deletions lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
<%- unless klass.method_list.empty? then %>
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
<h3>Methods</h3>
<% if (class_methods = klass.class_method_list.sort).any? %>
<div class="nav-section">
<h3>Class Methods</h3>
<ul class="link-list" role="directory">
<%- class_methods.each do |meth| -%>
<li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name -%></a></li>
<%- end -%>
</ul>
</div>
<% end %>

<ul class="link-list" role="directory">
<%- klass.each_method do |meth| -%>
<li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= h meth.name -%></a>
<%- end -%>
</ul>
</div>
<%- end -%>
<% if (instance_methods = klass.instance_methods.sort).any? %>
<div class="nav-section">
<h3>Instance Methods</h3>
<ul class="link-list" role="directory">
<%- instance_methods.each do |meth| -%>
<li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name -%></a></li>
<%- end -%>
</ul>
</div>
<% end %>
11 changes: 0 additions & 11 deletions lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml

This file was deleted.

10 changes: 6 additions & 4 deletions lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<%- simple_files = @files.select { |f| f.text? } %>
<%- if defined?(current) -%>

<%- if defined?(current) && current.respond_to?(:page_name) -%>
<%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name -%>
<%- end -%>

<%- unless simple_files.empty? then -%>
<div id="fileindex-section" class="nav-section">
<div class="nav-section">
<h3>Pages</h3>

<ul class="link-list">
Expand All @@ -12,7 +14,7 @@
<%- end.each do |n, files| -%>
<%- f = files.shift -%>
<%- if files.empty? -%>
<li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
<li class="<%= 'active' if defined?(dir) && (dir == f.page_name) %>"><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
<%- next -%>
<%- end -%>
<li><details<% if dir == n %> open<% end %>><summary><%
Expand All @@ -23,7 +25,7 @@
end %></summary>
<ul class="link-list">
<%- files.each do |f| -%>
<li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
<li class="<%= 'active' if defined?(dir) && (dir == f.page_name) %>"><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
<%- end -%>
</ul></details>
<%- end -%>
Expand Down
48 changes: 39 additions & 9 deletions lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
<%- if klass.type == 'class' then %>
<div id="parent-class-section" class="nav-section">
<h3>Parent</h3>
<%- if klass.type == 'class' && (ancestors = klass.super_classes).any? then -%>
<div class="nav-section">
<h3>Ancestors</h3>
<ul class="link-list" role="directory">
<%- ancestors.each_with_index do |ancestor, index| -%>
<%- if ancestor.is_a?(String) -%>
<li>
<%- if index == 0 && ancestors.size > 1 -%>
<details>
<summary><%= ancestor -%></summary>
<ul class="link-list" role="directory">
<%- else -%>
<span><%= ancestor -%></span>
<ul class="link-list" role="directory">
<%- end -%>
<%- elsif ancestor.is_a?(RDoc::NormalClass) -%>
<li>
<%- if index == 0 && ancestors.size > 1 -%>
<details>
<summary><a href="<%= klass.aref_to ancestor.path -%>"><%= ancestor.full_name -%></a></summary>
<ul class="link-list" role="directory">
<%- else -%>
<a href="<%= klass.aref_to ancestor.path -%>"><%= ancestor.full_name -%></a>
<ul class="link-list" role="directory">
<%- end -%>
<%- end -%>
<%- end -%>

<%- if klass.superclass and not String === klass.superclass then -%>
<p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a>
<%- else -%>
<p class="link"><%= klass.superclass %>
<%- end -%>
</div>
<%- ancestors.each_with_index do |ancestor, index| -%>
<%- if index == 0 && ancestors.size > 1 -%>
</ul>
</details>
</li>
<%- else -%>
</ul>
</li>
<%- end -%>
<%- end -%>
</ul>
</div>
<%- end -%>
16 changes: 8 additions & 8 deletions lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<%- unless klass.sections.length == 1 then %>
<div id="sections-section" class="nav-section">
<h3>Sections</h3>
<div class="nav-section">
<h3>Sections</h3>

<ul class="link-list" role="directory">
<%- klass.sort_sections.each do |section| -%>
<li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
<%- end -%>
</ul>
</div>
<ul class="link-list" role="directory">
<%- klass.sort_sections.each do |section| -%>
<li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
<%- end -%>
</ul>
</div>
<%- end -%>
Loading