Skip to content

Commit

Permalink
Remove a bunch of unnecessary blank lines
Browse files Browse the repository at this point in the history
Use `trim_mode: -` from standard `erb` library since RDoc's doesn't seem
to support it.

And add some other small changes to the template to avoid generating
blank lines.
  • Loading branch information
deivid-rodriguez committed Oct 20, 2020
1 parent 54a3c82 commit 0eb6ffa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 271 deletions.
8 changes: 3 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,10 @@ file 'command-reference.md' =>

filename = "command-reference.erb"

erbio = RDoc::ERBIO.new File.read(filename), nil, nil
erbio.filename = filename
erbio = ERB.new File.read(filename), trim_mode: '-'
content = erbio.result binding

open 'command-reference.md', 'w' do |io|
erbio.result binding
end
File.write 'command-reference.md', content
end

desc "serve documentation on http://localhost:4000"
Expand Down
23 changes: 10 additions & 13 deletions command-reference.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,28 @@ next: /rubygems-org-api

This reference was automatically generated from RubyGems version <%= rubygems_version %>.

<% commands.each do |name, command| %>* [gem <%= name %>](#gem-<%= name %>)
<% end %>
<%- commands.each do |name, command| -%><%= "* [gem #{name}](#gem-#{name})\n" %><%- end -%>
<%- commands.each do |name, command| -%>

<% commands.each do |name, command| %>
## gem <%= name %>

<%= htmlify(command.summary) %>

### Usage

<%= command.usage %> [options]
<%= options_list(command).rstrip + "\n" -%>
<%- if command.arguments != "" -%>

<%= options_list(command) %>

<% if command.arguments != "" %>
### Arguments

<% arguments = command.arguments.split("\n") %>
<% arguments.each do |argument| %><%= argument_list_item(argument) %>
<% end %>
<% end %>
<%- command.arguments.split("\n").each do |argument| -%><%= argument_list_item(argument) %>
<%- end -%>
<%- end -%>
<%- if command.description && command.description != "" -%>

<% if command.description && command.description != "" %>
### Description

<%= htmlify(command.description).gsub(/^ /, " ") %>
<% end %>
<% end %>
<%- end -%>
<%- end -%>
Loading

0 comments on commit 0eb6ffa

Please sign in to comment.