diff --git a/lib/puppet-strings/markdown/templates/classes_and_defines.erb b/lib/puppet-strings/markdown/templates/classes_and_defines.erb index 580156a..afacde4 100644 --- a/lib/puppet-strings/markdown/templates/classes_and_defines.erb +++ b/lib/puppet-strings/markdown/templates/classes_and_defines.erb @@ -1,7 +1,15 @@ ### <%= name %> -<%= text || summary || "The #{name} class." %> +<% if text -%> +<%= text %> +<% elsif summary -%> +<%= summary %> + +<% else -%> +<%= "The #{name} class." %> + +<% end -%> <% if since -%> * **Since** <%= since %> diff --git a/lib/puppet-strings/markdown/templates/function.erb b/lib/puppet-strings/markdown/templates/function.erb index e1e3d22..6f6a15b 100644 --- a/lib/puppet-strings/markdown/templates/function.erb +++ b/lib/puppet-strings/markdown/templates/function.erb @@ -1,8 +1,16 @@ ### <%= name %> Type: <%= type %> -<%= text || summary || "The #{name} function." %> +<% if text -%> +<%= text %> +<% elsif summary -%> +<%= summary %> + +<% else -%> +<%= "The #{name} class." %> + +<% end -%> <% signatures.each do |sig| -%> #### `<%= sig.signature %>` diff --git a/lib/puppet-strings/markdown/templates/resource_type.erb b/lib/puppet-strings/markdown/templates/resource_type.erb index 8cf9487..f517f40 100644 --- a/lib/puppet-strings/markdown/templates/resource_type.erb +++ b/lib/puppet-strings/markdown/templates/resource_type.erb @@ -1,7 +1,15 @@ ### <%= name %> -<%= text || summary || "The #{name} type." %> +<% if text -%> +<%= text %> +<% elsif summary -%> +<%= summary %> + +<% else -%> +<%= "The #{name} type." %> + +<% end -%> <% if since -%> * **Since** <%= since %> diff --git a/spec/fixtures/unit/markdown/output.md b/spec/fixtures/unit/markdown/output.md index e6bfc35..594f149 100644 --- a/spec/fixtures/unit/markdown/output.md +++ b/spec/fixtures/unit/markdown/output.md @@ -2,6 +2,8 @@ ## Classes * [`klass`](#klass): A simple class. +* [`noparams`](#noparams): Overview for class noparams +* [`noparams_desc`](#noparams_desc): ## Defined types * [`klass::dt`](#klassdt): A simple defined type. ## Resource types @@ -76,6 +78,16 @@ Third param. Default value: 'hi' +### noparams + +Overview for class noparams + + +### noparams_desc + +The noparams_desc class. + + ## Defined types ### klass::dt diff --git a/spec/unit/puppet-strings/markdown_spec.rb b/spec/unit/puppet-strings/markdown_spec.rb index 6eab938..98d0ab1 100644 --- a/spec/unit/puppet-strings/markdown_spec.rb +++ b/spec/unit/puppet-strings/markdown_spec.rb @@ -35,6 +35,11 @@ class klass ( ) inherits foo::bar { } +# Overview for class noparams +class noparams () {} + +class noparams_desc () {} + # An overview for a simple defined type. # @summary A simple defined type. # @since 1.1.0