From 9e27299a46a139a5af6c641b3bd939a139c23110 Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Thu, 2 Jul 2020 22:33:09 +0200 Subject: [PATCH] Remove empty lines from html file by using ERB trim_mode flag --- .../generator/template/darkfish/_head.rhtml | 9 +- .../template/darkfish/_sidebar_VCS_info.rhtml | 4 +- .../template/darkfish/_sidebar_classes.rhtml | 4 +- .../template/darkfish/_sidebar_extends.rhtml | 14 +-- .../template/darkfish/_sidebar_in_files.rhtml | 4 +- .../template/darkfish/_sidebar_includes.rhtml | 14 +-- .../darkfish/_sidebar_installed.rhtml | 12 +-- .../template/darkfish/_sidebar_methods.rhtml | 10 +-- .../template/darkfish/_sidebar_pages.rhtml | 10 +-- .../template/darkfish/_sidebar_parent.rhtml | 10 +-- .../template/darkfish/_sidebar_sections.rhtml | 8 +- .../darkfish/_sidebar_table_of_contents.rhtml | 8 +- .../generator/template/darkfish/class.rhtml | 88 +++++++++---------- .../generator/template/darkfish/index.rhtml | 7 +- .../template/darkfish/servlet_root.rhtml | 31 ++++--- .../template/darkfish/table_of_contents.rhtml | 32 +++---- 16 files changed, 131 insertions(+), 134 deletions(-) diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml index 8304310d4b..e61fce1b9a 100644 --- a/lib/rdoc/generator/template/darkfish/_head.rhtml +++ b/lib/rdoc/generator/template/darkfish/_head.rhtml @@ -15,9 +15,8 @@ -<% 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| -%> -<% end %> -<% end %> - +<%- end -%> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml index e889f8063d..22a12d9e95 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml @@ -1,4 +1,4 @@ -<% if !svninfo.empty? then %> +<%- if !svninfo.empty? then %> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml index fe54d8339f..530f25c762 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml @@ -2,8 +2,8 @@

Class and Module Index

diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml index 2bd8efee99..7602076c96 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml @@ -1,15 +1,15 @@ -<% unless klass.extends.empty? then %> +<%- unless klass.extends.empty? then %> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml index 0ba1d2be80..74869a4b51 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml @@ -2,8 +2,8 @@

Defined In

diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml index d141098ecd..5b600e5975 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml @@ -1,15 +1,15 @@ -<% unless klass.includes.empty? then %> +<%- unless klass.includes.empty? then %> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml index 1285bfd732..faed7e0a94 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml @@ -2,14 +2,14 @@

Documentation

diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml index 45df08d8fe..5b4c295bed 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml @@ -1,12 +1,12 @@ -<% unless klass.method_list.empty? then %> +<%- unless klass.method_list.empty? then %> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml index 5f39825f08..8ec83abda2 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml @@ -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 -%> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml index cc04852652..1420da3201 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml @@ -1,11 +1,11 @@ -<% if klass.type == 'class' then %> +<%- if klass.type == 'class' then %> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml index 15ff78ba91..6dcd2ae81f 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml @@ -1,11 +1,11 @@ -<% unless klass.sections.length == 1 then %> +<%- unless klass.sections.length == 1 then %> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml index b58e6b3c61..bf70819f64 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml @@ -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 @@ -10,9 +10,9 @@

Table of Contents

-<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml index 596764ddc5..5d7b6a1b80 100644 --- a/lib/rdoc/generator/template/darkfish/class.rhtml +++ b/lib/rdoc/generator/template/darkfish/class.rhtml @@ -25,9 +25,9 @@ <%= klass.description %> - <% klass.each_section do |section, constants, attributes| %> + <%- klass.each_section do |section, constants, attributes| -%>
- <% if section.title then %> + <%- if section.title then -%>

<%= section.title %> @@ -36,39 +36,39 @@ ↑ top

- <% end %> + <%- end -%> - <% if section.comment then %> + <%- if section.comment then -%>
<%= section.description %>
- <% end %> + <%- end -%> - <% unless constants.empty? then %> + <%- unless constants.empty? then -%>

Constants

- <% constants.each do |const| %> + <%- constants.each do |const| -%>
<%= const.name %> - <% if const.comment then %> + <%- if const.comment then -%>
<%= const.description.strip %> - <% else %> + <%- else -%>
(Not documented) - <% end %> - <% end %> + <%- end -%> + <%- end -%>
- <% end %> + <%- end -%> - <% unless attributes.empty? then %> + <%- unless attributes.empty? then -%>

Attributes

- <% attributes.each do |attrib| %> + <%- attributes.each do |attrib| -%>
<%= h attrib.name %>
- <% if attrib.comment then %> + <%- if attrib.comment then -%> <%= attrib.description.strip %> - <% else %> + <%- else -%>

(Not documented) - <% end %> + <%- end -%>

- <% end %> + <%- end -%>
- <% 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? %> @@ -96,38 +96,38 @@

<%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods

- <% methods.each do |method| %> + <%- methods.each do |method| -%>
"> - <% 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| -%>
<%= h(call_seq.strip. gsub( /^\w+\./m, '')). gsub(/(.*)[-=]>/, '\1→') %> - <% if i == 0 and method.token_stream then %> + <%- if i == 0 and method.token_stream then -%> click to toggle source - <% end %> + <%- end -%>
- <% end %> - <% else %> + <%- end -%> + <%- else -%>
<%= h method.name %><%= h method.param_seq %> - <% if method.token_stream then %> + <%- if method.token_stream then -%> click to toggle source - <% end %> + <%- end -%>
- <% end %> + <%- end -%>
- <% if method.comment then %> + <%- if method.comment then -%> <%= method.description.strip %> - <% else %> + <%- else -%>

(Not documented) - <% end %> - <% if method.calls_super then %> + <%- end -%> + <%- if method.calls_super then -%>

Calls superclass method <%= @@ -135,16 +135,16 @@ method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil %>
- <% end %> + <%- end -%> - <% if method.token_stream then %> + <%- if method.token_stream then -%>
<%= method.markup_code %>
- <% end %> + <%- end -%>
- <% unless method.aliases.empty? then %> + <%- unless method.aliases.empty? then -%>
Also aliased as: <%= method.aliases.map do |aka| if aka.parent then # HACK lib/rexml/encodings @@ -154,19 +154,19 @@ end end.join ", " %>
- <% end %> + <%- end -%> - <% if method.is_alias_for then %> + <%- if method.is_alias_for then -%> - <% end %> + <%- end -%>
- <% end %> + <%- end -%>
- <% end + <%- end end %> -<% end %> +<%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/index.rhtml b/lib/rdoc/generator/template/darkfish/index.rhtml index 7d1c74807b..13fa3dcc7f 100644 --- a/lib/rdoc/generator/template/darkfish/index.rhtml +++ b/lib/rdoc/generator/template/darkfish/index.rhtml @@ -13,11 +13,10 @@
-<% if @options.main_page and +<%- if @options.main_page and main_page = @files.find { |f| f.full_name == @options.main_page } then %> <%= main_page.description %> -<% else %> +<%- else -%>

This is the API documentation for <%= @title %>. -<% end %> +<%- end -%>

- diff --git a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml index 3a33659aea..cab3092b17 100644 --- a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +++ b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml @@ -19,28 +19,28 @@

Here you can browse local documentation from the ruby standard library and your installed gems. -<% extra_dirs = installed.select { |_, _, _, type,| type == :extra } %> -<% unless extra_dirs.empty? %> +<%- extra_dirs = installed.select { |_, _, _, type,| type == :extra } -%> +<%- unless extra_dirs.empty? -%>

Extra Documentation Directories

The following additional documentation directories are available:

    - <% extra_dirs.each do |name, href, exists, _, path| %> + <%- extra_dirs.each do |name, href, exists, _, path| -%>
  1. - <% if exists %> + <%- if exists -%> <%= h name %> (<%= h path %>) - <% else %> + <%- else -%> <%= h name %> (<%= h path %>; not available) - <% end %> + <%- end -%>
  2. - <% end %> + <%- end -%>
-<% end %> +<%- end -%> -<% gems = installed.select { |_, _, _, type,| type == :gem } %> -<% missing = gems.reject { |_, _, exists,| exists } %> -<% unless missing.empty? then %> +<%- gems = installed.select { |_, _, _, type,| type == :gem } -%> +<%- missing = gems.reject { |_, _, exists,| exists } -%> +<%- unless missing.empty? then -%>

Missing Gem Documentation

You are missing documentation for some of your installed gems. @@ -53,11 +53,10 @@ the following commands.

-<% end %> +<%- end -%> - diff --git a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml index 7ff1a9e93e..303d7016cc 100644 --- a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +++ b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml @@ -2,11 +2,11 @@

<%= h @title %>

-<% simple_files = @files.select { |f| f.text? } %> -<% unless simple_files.empty? then %> +<%- simple_files = @files.select { |f| f.text? } -%> +<%- unless simple_files.empty? then -%>

Pages

-<% end %> +<%- end -%>

Classes and Modules

Methods