Skip to content

Commit

Permalink
Remove empty lines by properly mark lines with ERB proper trim_mode flag
Browse files Browse the repository at this point in the history
  • Loading branch information
benoittgt committed Jul 2, 2020
1 parent 3c870ce commit 48174b6
Show file tree
Hide file tree
Showing 16 changed files with 131 additions and 134 deletions.
9 changes: 4 additions & 5 deletions lib/rdoc/generator/template/darkfish/_head.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@

<link href="<%= asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
<link href="<%= asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
<% if @options.template_stylesheets.flatten.any? then %>
<% @options.template_stylesheets.flatten.each do |stylesheet| %>
<%- if @options.template_stylesheets.flatten.any? then -%>
<%- @options.template_stylesheets.flatten.each do |stylesheet| -%>
<link href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
<% end %>
<% end %>

<%- end -%>
<%- end -%>
4 changes: 2 additions & 2 deletions lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if !svninfo.empty? then %>
<%- if !svninfo.empty? then %>
<div id="file-svninfo-section" class="nav-section">
<h3>VCS Info</h3>

Expand All @@ -16,4 +16,4 @@
</dl>
</div>
</div>
<% end %>
<%- end -%>
4 changes: 2 additions & 2 deletions lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<h3>Class and Module Index</h3>

<ul class="link-list">
<% @modsort.each do |index_klass| %>
<%- @modsort.each do |index_klass| -%>
<li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a>
<% end %>
<%- end -%>
</ul>
</div>
14 changes: 7 additions & 7 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 %>
<%- unless klass.extends.empty? then %>
<div id="extends-section" class="nav-section">
<h3>Extended With Modules</h3>

<ul class="link-list">
<% klass.each_extend do |ext| %>
<% unless String === ext.module then %>
<%- 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 %>
<%- else -%>
<li><span class="extend"><%= ext.name %></span>
<% end %>
<% end %>
<%- end -%>
<%- end -%>
</ul>
</div>
<% end %>
<%- end -%>
4 changes: 2 additions & 2 deletions lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<h3>Defined In</h3>

<ul>
<% klass.in_files.each do |tl| %>
<%- klass.in_files.each do |tl| -%>
<li><%= h tl.relative_name %>
<% end %>
<%- end -%>
</ul>
</div>
14 changes: 7 additions & 7 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 %>
<%- unless klass.includes.empty? then %>
<div id="includes-section" class="nav-section">
<h3>Included Modules</h3>

<ul class="link-list">
<% klass.each_include do |inc| %>
<% unless String === inc.module then %>
<%- 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 %>
<%- else -%>
<li><span class="include"><%= inc.name %></span>
<% end %>
<% end %>
<%- end -%>
<%- end -%>
</ul>
</div>
<% end %>
<%- end -%>
12 changes: 6 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,14 @@
<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 -%>
<%- end -%>
</ul>
</div>
10 changes: 5 additions & 5 deletions lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<% unless klass.method_list.empty? then %>
<%- unless klass.method_list.empty? then %>
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
<h3>Methods</h3>

<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 %>
<%- 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 %>
<%- end -%>
10 changes: 5 additions & 5 deletions lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<% simple_files = @files.select { |f| f.text? } %>
<% unless simple_files.empty? then %>
<%- simple_files = @files.select { |f| f.text? } %>
<%- unless simple_files.empty? then -%>
<div id="fileindex-section" class="nav-section">
<h3>Pages</h3>

<ul class="link-list">
<% simple_files.each do |f| %>
<%- simple_files.each do |f| -%>
<li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
<% end %>
<%- end -%>
</ul>
</div>
<% end %>
<%- end -%>
10 changes: 5 additions & 5 deletions lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% if klass.type == 'class' then %>
<%- if klass.type == 'class' then %>
<div id="parent-class-section" class="nav-section">
<h3>Parent</h3>

<% if klass.superclass and not String === klass.superclass then %>
<%- 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 %>
<%- else -%>
<p class="link"><%= klass.superclass %>
<% end %>
<%- end -%>
</div>
<% end %>
<%- end -%>
8 changes: 4 additions & 4 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 %>
<%- unless klass.sections.length == 1 then %>
<div id="sections-section" class="nav-section">
<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
@@ -1,4 +1,4 @@
<% comment = if current.respond_to? :comment_location then
<%- comment = if current.respond_to? :comment_location then
current.comment_location
else
current.comment
Expand All @@ -10,9 +10,9 @@
<h3>Table of Contents</h3>

<ul class="link-list" role="directory">
<% table.each do |heading| %>
<%- table.each do |heading| -%>
<li><a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
<% end %>
<%- end -%>
</ul>
</div>
<% end %>
<%- end -%>
88 changes: 44 additions & 44 deletions lib/rdoc/generator/template/darkfish/class.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<%= klass.description %>
</section>

<% klass.each_section do |section, constants, attributes| %>
<%- klass.each_section do |section, constants, attributes| -%>
<section id="<%= section.aref %>" class="documentation-section">
<% if section.title then %>
<%- if section.title then -%>
<header class="documentation-section-title">
<h2>
<%= section.title %>
Expand All @@ -36,58 +36,58 @@
<a href="#top">&uarr; top</a>
</span>
</header>
<% end %>
<%- end -%>

<% if section.comment then %>
<%- if section.comment then -%>
<div>
<%= section.description %>
</div>
<% end %>
<%- end -%>

<% unless constants.empty? then %>
<%- unless constants.empty? then -%>
<section class="constants-list">
<header>
<h3>Constants</h3>
</header>
<dl>
<% constants.each do |const| %>
<%- constants.each do |const| -%>
<dt id="<%= const.name %>"><%= const.name %>
<% if const.comment then %>
<%- if const.comment then -%>
<dd><%= const.description.strip %>
<% else %>
<%- else -%>
<dd class="missing-docs">(Not documented)
<% end %>
<% end %>
<%- end -%>
<%- end -%>
</dl>
</section>
<% end %>
<%- end -%>

<% unless attributes.empty? then %>
<%- unless attributes.empty? then -%>
<section class="attribute-method-details" class="method-section">
<header>
<h3>Attributes</h3>
</header>

<% attributes.each do |attrib| %>
<%- attributes.each do |attrib| -%>
<div id="<%= attrib.aref %>" class="method-detail">
<div class="method-heading attribute-method-heading">
<span class="method-name"><%= h attrib.name %></span><span
class="attribute-access-type">[<%= attrib.rw %>]</span>
</div>

<div class="method-description">
<% if attrib.comment then %>
<%- if attrib.comment then -%>
<%= attrib.description.strip %>
<% else %>
<%- else -%>
<p class="missing-docs">(Not documented)
<% end %>
<%- end -%>
</div>
</div>
<% end %>
<%- end -%>
</section>
<% end %>
<%- end -%>

<% klass.methods_by_type(section).each do |type, visibilities|
<%- klass.methods_by_type(section).each do |type, visibilities|
next if visibilities.empty?
visibilities.each do |visibility, methods|
next if methods.empty? %>
Expand All @@ -96,55 +96,55 @@
<h3><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
</header>

<% methods.each do |method| %>
<%- methods.each do |method| -%>
<div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
<% if (call_seq = method.call_seq) then %>
<% call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
<%- if (call_seq = method.call_seq) then -%>
<%- call_seq.strip.split("\n").each_with_index do |call_seq, i| -%>
<div class="method-heading">
<span class="method-callseq">
<%= h(call_seq.strip.
gsub( /^\w+\./m, '')).
gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
</span>
<% if i == 0 and method.token_stream then %>
<%- if i == 0 and method.token_stream then -%>
<span class="method-click-advice">click to toggle source</span>
<% end %>
<%- end -%>
</div>
<% end %>
<% else %>
<%- end -%>
<%- else -%>
<div class="method-heading">
<span class="method-name"><%= h method.name %></span><span
class="method-args"><%= h method.param_seq %></span>
<% if method.token_stream then %>
<%- if method.token_stream then -%>
<span class="method-click-advice">click to toggle source</span>
<% end %>
<%- end -%>
</div>
<% end %>
<%- end -%>

<div class="method-description">
<% if method.comment then %>
<%- if method.comment then -%>
<%= method.description.strip %>
<% else %>
<%- else -%>
<p class="missing-docs">(Not documented)
<% end %>
<% if method.calls_super then %>
<%- end -%>
<%- if method.calls_super then -%>
<div class="method-calls-super">
Calls superclass method
<%=
method.superclass_method ?
method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil
%>
</div>
<% end %>
<%- end -%>

<% if method.token_stream then %>
<%- if method.token_stream then -%>
<div class="method-source-code" id="<%= method.html_name %>-source">
<pre><%= method.markup_code %></pre>
</div>
<% end %>
<%- end -%>
</div>

<% unless method.aliases.empty? then %>
<%- unless method.aliases.empty? then -%>
<div class="aliases">
Also aliased as: <%= method.aliases.map do |aka|
if aka.parent then # HACK lib/rexml/encodings
Expand All @@ -154,19 +154,19 @@
end
end.join ", " %>
</div>
<% end %>
<%- end -%>

<% if method.is_alias_for then %>
<%- if method.is_alias_for then -%>
<div class="aliases">
Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
</div>
<% end %>
<%- end -%>
</div>

<% end %>
<%- end -%>
</section>
<% end
<%- end
end %>
</section>
<% end %>
<%- end -%>
</main>
Loading

0 comments on commit 48174b6

Please sign in to comment.