Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ jobs:
bundler-cache: true
- name: Run rubocop
run: bundle exec rubocop
- name: Run herb linter
# npx should be available by default so we don't need `setup-node` action
# Don't lint erb files outside of lib as the current directory also includes vendor/bundle
run: npx @herb-tools/linter "lib/**/*.rhtml"
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"marcoroth.herb-lsp"
]
}
6 changes: 3 additions & 3 deletions lib/rdoc/generator/template/darkfish/_footer.rhtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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>.
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> <%= RDoc::VERSION %>.</p>
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>
</footer>
28 changes: 14 additions & 14 deletions lib/rdoc/generator/template/darkfish/_head.rhtml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<meta charset="<%= @options.charset %>">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1">

<title><%= h @title %></title>

<%- if defined?(klass) -%>
<%- if defined?(klass) %>
<meta name="keywords" content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>">

<%- if klass.comment.empty? -%>
<%- if klass.comment.empty? %>
<meta name="description" content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>">
<%- else -%>
<%- else %>
<meta name="description" content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>">
<%- end -%>
<%- elsif defined?(file) -%>
<%- end %>
<%- elsif defined?(file) %>
<meta name="keywords" content="ruby,documentation,<%= h file.page_name %>">
<meta name="description" content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>">
<%- elsif @title -%>
<%- elsif @title %>
<meta name="keywords" content="ruby,documentation,<%= h @title %>">

<%- if @options.main_page and
main_page = @files.find { |f| f.full_name == @options.main_page } then %>
<meta name="description" content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>">
<%- else -%>
<%- else %>
<meta name="description" content="Documentation for <%= h @title %>">
<%- end -%>
<%- end -%>
<%- end %>
<%- end %>

<%- if canonical_url = @options.canonical_root -%>
<%- if canonical_url = @options.canonical_root %>
<% canonical_url = current.canonical_url if defined?(current) %>
<link rel="canonical" href="<%= canonical_url %>">
<%- end -%>
<%- end %>

<script type="text/javascript">
var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
Expand All @@ -43,6 +43,6 @@

<link href="<%= h asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
<link href="<%= h asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
<%- @options.template_stylesheets.each do |stylesheet| -%>
<%- @options.template_stylesheets.each do |stylesheet| %>
<link href="<%= h asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
<%- end -%>
<%- end %>
16 changes: 8 additions & 8 deletions lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<h3>Extended With Modules</h3>

<ul class="link-list">
<%- klass.extends.each 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 -%>
<%- klass.extends.each do |ext| %>
<%- unless String === ext.module then %>
<li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a></li>
<%- else %>
<li><span class="extend"><%= ext.name %></span></li>
<%- end %>
<%- end %>
</ul>
</div>
<%- end -%>
<%- end %>
16 changes: 8 additions & 8 deletions lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<h3>Included Modules</h3>

<ul class="link-list">
<%- klass.includes.each 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 -%>
<%- klass.includes.each do |inc| %>
<%- unless String === inc.module then %>
<li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li>
<%- else %>
<li><span class="include"><%= inc.name %></span></li>
<%- end %>
<%- end %>
</ul>
</div>
<%- end -%>
<%- end %>
13 changes: 7 additions & 6 deletions lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<h3>Documentation</h3>

<ul>
<%- installed.each do |name, href, exists, type, _| -%>
<%- next if type == :extra -%>
<%- installed.each do |name, href, exists, type, _| %>
<%- next if type == :extra %>
<li class="folder">
<%- if exists then -%>
<%- if exists then %>
<a href="<%= href %>"><%= h name %></a>
<%- else -%>
<%- else %>
<%= h name %>
<%- end -%>
<%- end -%>
<%- end %>
</li>
<%- end %>
</ul>
</div>
12 changes: 6 additions & 6 deletions lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<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 -%>
<%- 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 %>
Expand All @@ -13,9 +13,9 @@
<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 -%>
<%- 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 %>
38 changes: 19 additions & 19 deletions lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<%- simple_files = @files.select { |f| f.text? } %>
<%- if defined?(current) -%>
<%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name -%>
<%- end -%>
<%- unless simple_files.empty? then -%>
<%- if defined?(current) %>
<%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name %>
<%- end %>
<%- unless simple_files.empty? then %>
<div id="fileindex-section" class="nav-section">
<h3>Pages</h3>

<ul class="link-list">
<%- simple_files.group_by do |f| -%>
<%- f.full_name[%r{\A[^/]+(?=/)}] || f.page_name -%>
<%- end.each do |n, files| -%>
<%- f = files.shift -%>
<%- if files.empty? -%>
<li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
<%- next -%>
<%- end -%>
<li><details<% if dir == n %> open<% end %>><summary><%
<%- simple_files.group_by do |f|
f.full_name[%r{\A[^/]+(?=/)}] || f.page_name
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>
<%- next %>
<%- end %>
<li><details<%= ' open' if dir == n %>><summary><%
if n == f.page_name
%><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h n %></a><%
else
%><%= h n %><% files.unshift(f)
end %></summary>
<ul class="link-list">
<%- files.each do |f| -%>
<li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
<%- end -%>
</ul></details>
<%- end -%>
<%- files.each do |f| %>
<li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a></li>
<%- end %>
</ul></details></li>
<%- end %>
</ul>
</div>
<%- end -%>
<%- end %>
4 changes: 2 additions & 2 deletions lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%- if klass.type == 'class' && (ancestors = klass.super_classes).any? -%>
<%- if klass.type == 'class' && (ancestors = klass.super_classes).any? %>
<div id="parent-class-section" class="nav-section">
<h3>Ancestors</h3>
<%= generate_ancestor_list(ancestors, klass) %>
</div>
<%- end -%>
<%- end %>
6 changes: 3 additions & 3 deletions lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<h3>Sections</h3>

<ul class="link-list" role="directory">
<%- klass.sort_sections.each do |section| -%>
<%- klass.sort_sections.each do |section| %>
<li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
<%- end -%>
<%- end %>
</ul>
</div>
<%- end -%>
<%- end %>
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@
<div class="nav-section">
<h3>Table of Contents</h3>

<%- display_link = proc do |heading| -%>
<%- display_link = proc do |heading| %>
<a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
<%- end -%>
<%- end %>

<%- list_siblings = proc do -%>
<%- level = table.first&.level -%>
<%- while table.first && table.first.level >= level -%>
<%- heading = table.shift -%>
<%- if table.first.nil? || table.first.level <= heading.level -%>
<li><% display_link.call heading -%>
<%- else -%>
<%- list_siblings = proc do %>
<%- level = table.first&.level %>
<%- while table.first && table.first.level >= level %>
<%- heading = table.shift %>
<%- if table.first.nil? || table.first.level <= heading.level %>
<li><% display_link.call heading %></li>
<%- else %>
<li>
<details open>
<summary><%- display_link.call heading -%></summary>
<summary><%- display_link.call heading %></summary>
<ul class="link-list" role="directory">
<% list_siblings.call %>
</ul>
</details>
</li>
<%- end -%>
<%- end -%>
<%- end -%>
<%- end %>
<%- end %>
<%- end %>

<ul class="link-list" role="directory">
<% list_siblings.call %>
</ul>
</div>
<%- end -%>
<%- end %>
Loading
Loading