Skip to content

Commit

Permalink
Merge pull request #255 from trevor-vaughan/fix_resource_type_erb
Browse files Browse the repository at this point in the history
Fix ERB failure - parameters without descriptions
  • Loading branch information
michaeltlombardi committed Oct 19, 2020
2 parents fa7ed23 + e7319c2 commit 944198f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/puppet-strings/markdown/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,12 @@ def word_wrap(text, line_width: 120, break_sequence: "\n")

# @return [String] full markdown rendering of a component
def render(template)
file = File.join(File.dirname(__FILE__),"templates/#{template}")
ERB.new(File.read(file), nil, '-').result(binding)
begin
file = File.join(File.dirname(__FILE__),"templates/#{template}")
ERB.new(File.read(file), nil, '-').result(binding)
rescue StandardError => e
fail "Processing #{@registry[:file]}:#{@registry[:line]} with #{file} => #{e}"
end
end

private
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet-strings/markdown/templates/resource_type.erb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ Aliases: `<%= param[:aliases].to_s.delete('{').delete('}') %>`
Data type: `<%= param[:data_type] %>`<%= "\n_\*this data type contains a regex that may not be accurately reflected in generated documentation_" if regex_in_data_type?(param[:data_type]) %>
<% end -%>
<% if param[:description] -%>
<%= word_wrap(param[:description]) %>
<% end -%>
<% if options_for_param(param[:name]) -%>
Options:
Expand Down

0 comments on commit 944198f

Please sign in to comment.