Skip to content

Commit

Permalink
(#304) Fix double backticks in Markdown
Browse files Browse the repository at this point in the history
Previously, some values in generated Markdown were wrapped in double
backticks instead of single backticks. This removes the code that added
the extra backticks.
  • Loading branch information
danielparks committed Sep 23, 2022
1 parent dba16ed commit 9602878
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
13 changes: 0 additions & 13 deletions lib/puppet-strings/markdown/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,6 @@ def link
name.delete('::').strip.gsub(' ','-').downcase
end

# Some return, default, or valid values need to be in backticks. Instead of fu in the handler or code_object, this just does the change on the front.
# @param value
# any string
# @return [String] value or value in backticks if it is in a list
def value_string(value)
to_symbol = %w[undef true false]
if to_symbol.include? value
return "`#{value}`"
else
return value
end
end

def private?
@tags.any? { |tag| tag[:tag_name] == 'api' && tag[:text] == 'private' }
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Options:

<% end -%>
<% if defaults && defaults[param[:name]] -%>
Default value: `<%= value_string(defaults[param[:name]]) %>`
Default value: `<%= defaults[param[:name]] %>`

<% end -%>
<% end -%>
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-strings/markdown/templates/data_type.erb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Options:

<% end -%>
<% if defaults && defaults[param[:name]] -%>
Default value: `<%= value_string(defaults[param[:name]]) %>`
Default value: `<%= defaults[param[:name]] %>`

<% end -%>
<% end -%>
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet-strings/markdown/templates/resource_type.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The following properties are available in the `<%= name %>` <%= @type %>.
##### `<%= prop[:name] %>`

<% if prop[:values] -%>
Valid values: `<%= prop[:values].map { |value| value_string(value) }.join('`, `') %>`
Valid values: `<%= prop[:values].join('`, `') %>`

<% end -%>
<% if prop[:isnamevar] -%>
Expand Down Expand Up @@ -105,7 +105,7 @@ The following parameters are available in the `<%= name %>` <%= @type %>.
##### <a name="<%= param[:name] %>"></a>`<%= param[:name] %>`

<% if param[:values] -%>
Valid values: `<%= param[:values].map { |value| value_string(value) }.join('`, `') %>`
Valid values: `<%= param[:values].join('`, `') %>`

<% end -%>
<% if param[:isnamevar] -%>
Expand Down Expand Up @@ -141,7 +141,7 @@ Options:

<% end -%>
<% if param[:default] -%>
Default value: `<%= value_string(param[:default]) %>`
Default value: `<%= param[:default] %>`

<% end -%>
<% if param[:required_features] -%>
Expand Down

0 comments on commit 9602878

Please sign in to comment.