Skip to content

(#304) Fix double backticks in Markdown #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions lib/puppet-strings/markdown/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,6 @@ def link
clean_link(name)
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[:link] %>"></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