puppet-strings 2.3.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +102 -4
  3. data/COMMITTERS.md +17 -17
  4. data/CONTRIBUTING.md +37 -7
  5. data/README.md +17 -12
  6. data/lib/puppet-strings.rb +5 -3
  7. data/lib/puppet-strings/describe.rb +2 -0
  8. data/lib/puppet-strings/json.rb +2 -0
  9. data/lib/puppet-strings/markdown.rb +12 -10
  10. data/lib/puppet-strings/markdown/base.rb +30 -3
  11. data/lib/puppet-strings/markdown/data_type.rb +18 -0
  12. data/lib/puppet-strings/markdown/data_types.rb +3 -1
  13. data/lib/puppet-strings/markdown/defined_type.rb +2 -0
  14. data/lib/puppet-strings/markdown/defined_types.rb +3 -1
  15. data/lib/puppet-strings/markdown/function.rb +9 -7
  16. data/lib/puppet-strings/markdown/functions.rb +3 -1
  17. data/lib/puppet-strings/markdown/puppet_class.rb +2 -0
  18. data/lib/puppet-strings/markdown/puppet_classes.rb +3 -1
  19. data/lib/puppet-strings/markdown/puppet_plan.rb +2 -0
  20. data/lib/puppet-strings/markdown/puppet_plans.rb +3 -1
  21. data/lib/puppet-strings/markdown/puppet_task.rb +2 -0
  22. data/lib/puppet-strings/markdown/puppet_tasks.rb +3 -1
  23. data/lib/puppet-strings/markdown/resource_type.rb +21 -2
  24. data/lib/puppet-strings/markdown/resource_types.rb +3 -1
  25. data/lib/puppet-strings/markdown/table_of_contents.rb +3 -1
  26. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +18 -6
  27. data/lib/puppet-strings/markdown/templates/data_type.erb +30 -7
  28. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  29. data/lib/puppet-strings/markdown/templates/function.erb +10 -1
  30. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  31. data/lib/puppet-strings/markdown/templates/resource_type.erb +35 -13
  32. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +6 -6
  33. data/lib/puppet-strings/monkey_patches/display_object_command.rb +2 -0
  34. data/lib/puppet-strings/tasks.rb +2 -0
  35. data/lib/puppet-strings/tasks/generate.rb +2 -0
  36. data/lib/puppet-strings/tasks/gh_pages.rb +3 -0
  37. data/lib/puppet-strings/version.rb +3 -1
  38. data/lib/puppet-strings/yard.rb +9 -0
  39. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  40. data/lib/puppet-strings/yard/code_objects/base.rb +2 -0
  41. data/lib/puppet-strings/yard/code_objects/class.rb +4 -2
  42. data/lib/puppet-strings/yard/code_objects/data_type.rb +30 -8
  43. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +2 -0
  44. data/lib/puppet-strings/yard/code_objects/defined_type.rb +4 -2
  45. data/lib/puppet-strings/yard/code_objects/function.rb +8 -5
  46. data/lib/puppet-strings/yard/code_objects/group.rb +3 -0
  47. data/lib/puppet-strings/yard/code_objects/plan.rb +4 -2
  48. data/lib/puppet-strings/yard/code_objects/provider.rb +6 -0
  49. data/lib/puppet-strings/yard/code_objects/task.rb +3 -1
  50. data/lib/puppet-strings/yard/code_objects/type.rb +49 -5
  51. data/lib/puppet-strings/yard/handlers.rb +2 -0
  52. data/lib/puppet-strings/yard/handlers/helpers.rb +2 -0
  53. data/lib/puppet-strings/yard/handlers/json/base.rb +2 -0
  54. data/lib/puppet-strings/yard/handlers/json/task_handler.rb +2 -0
  55. data/lib/puppet-strings/yard/handlers/puppet/base.rb +3 -0
  56. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +2 -0
  57. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +2 -0
  58. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +2 -0
  59. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +3 -1
  60. data/lib/puppet-strings/yard/handlers/puppet/plan_handler.rb +2 -0
  61. data/lib/puppet-strings/yard/handlers/ruby/base.rb +5 -0
  62. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +225 -52
  63. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +9 -7
  64. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +13 -0
  65. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +4 -1
  66. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +20 -6
  67. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +6 -3
  68. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +18 -1
  69. data/lib/puppet-strings/yard/parsers.rb +2 -0
  70. data/lib/puppet-strings/yard/parsers/json/parser.rb +2 -0
  71. data/lib/puppet-strings/yard/parsers/json/task_statement.rb +2 -0
  72. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +18 -14
  73. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +4 -0
  74. data/lib/puppet-strings/yard/tags.rb +4 -0
  75. data/lib/puppet-strings/yard/tags/enum_tag.rb +14 -0
  76. data/lib/puppet-strings/yard/tags/factory.rb +18 -0
  77. data/lib/puppet-strings/yard/tags/overload_tag.rb +4 -1
  78. data/lib/puppet-strings/yard/tags/parameter_directive.rb +5 -4
  79. data/lib/puppet-strings/yard/tags/property_directive.rb +5 -4
  80. data/lib/puppet-strings/yard/tags/summary_tag.rb +2 -0
  81. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
  82. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +9 -1
  83. data/lib/puppet-strings/yard/templates/default/puppet_function/html/setup.rb +1 -1
  84. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +3 -1
  85. data/lib/puppet-strings/yard/templates/default/tags/html/enum.erb +17 -0
  86. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +6 -0
  87. data/lib/puppet-strings/yard/util.rb +7 -4
  88. data/lib/puppet/application/strings.rb +2 -0
  89. data/lib/puppet/face/strings.rb +4 -1
  90. data/lib/puppet/feature/rgen.rb +2 -0
  91. data/lib/puppet/feature/yard.rb +2 -0
  92. metadata +14 -51
  93. data/Gemfile +0 -47
  94. data/HISTORY.md +0 -218
  95. data/JSON.md +0 -832
  96. data/Rakefile +0 -168
  97. data/codecov.yml +0 -3
  98. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  99. data/spec/acceptance/emit_json_options_spec.rb +0 -69
  100. data/spec/acceptance/generate_markdown_spec.rb +0 -47
  101. data/spec/acceptance/running_strings_generate_spec.rb +0 -78
  102. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  103. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  104. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  105. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  106. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  107. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  108. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  109. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -10
  110. data/spec/fixtures/acceptance/modules/test/types/elephant.pp +0 -2
  111. data/spec/fixtures/unit/markdown/output.md +0 -508
  112. data/spec/fixtures/unit/markdown/output_with_data_types.md +0 -553
  113. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -542
  114. data/spec/spec_helper.rb +0 -49
  115. data/spec/spec_helper_acceptance.rb +0 -58
  116. data/spec/spec_helper_acceptance_local.rb +0 -10
  117. data/spec/unit/puppet-strings/describe_spec.rb +0 -141
  118. data/spec/unit/puppet-strings/json_spec.rb +0 -302
  119. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  120. data/spec/unit/puppet-strings/markdown_spec.rb +0 -357
  121. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  122. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -116
  123. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  124. data/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb +0 -65
  125. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  126. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  127. data/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb +0 -232
  128. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -746
  129. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -158
  130. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -235
  131. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -311
  132. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -72
  133. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  134. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -251
  135. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings'
2
4
  require 'puppet-strings/json'
3
5
  require 'puppet-strings/yard'
@@ -68,7 +70,7 @@ module PuppetStrings::Markdown
68
70
 
69
71
  # @return [String] top-level name
70
72
  def name
71
- @registry[:name].to_s unless @registry[:name].nil?
73
+ @registry[:name]&.to_s
72
74
  end
73
75
 
74
76
  # @return [String] 'Overview' text (untagged text)
@@ -111,6 +113,11 @@ module PuppetStrings::Markdown
111
113
  select_tags('option')
112
114
  end
113
115
 
116
+ # @return [Array] enum tag hashes
117
+ def enums
118
+ select_tags('enum')
119
+ end
120
+
114
121
  # @param parameter_name
115
122
  # parameter name to match to option tags
116
123
  # @return [Array] option tag hashes that have a parent parameter_name
@@ -119,6 +126,14 @@ module PuppetStrings::Markdown
119
126
  opts_for_p unless opts_for_p.nil? || opts_for_p.length.zero?
120
127
  end
121
128
 
129
+ # @param parameter_name
130
+ # parameter name to match to enum tags
131
+ # @return [Array] enum tag hashes that have a parent parameter_name
132
+ def enums_for_param(parameter_name)
133
+ enums_for_p = enums.select { |e| e[:parent] == parameter_name } unless enums.nil?
134
+ enums_for_p unless enums_for_p.nil? || enums_for_p.length.zero?
135
+ end
136
+
122
137
  # @return [Hash] any defaults found for the component
123
138
  def defaults
124
139
  @registry[:defaults] unless @registry[:defaults].nil?
@@ -156,10 +171,22 @@ module PuppetStrings::Markdown
156
171
  @tags.any? { |tag| tag[:tag_name] == 'api' && tag[:text] == 'private' }
157
172
  end
158
173
 
174
+ def word_wrap(text, line_width: 120, break_sequence: "\n")
175
+ return unless text
176
+
177
+ text.split("\n").collect! do |line|
178
+ line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1#{break_sequence}").strip : line
179
+ end * break_sequence
180
+ end
181
+
159
182
  # @return [String] full markdown rendering of a component
160
183
  def render(template)
161
- file = File.join(File.dirname(__FILE__),"templates/#{template}")
162
- ERB.new(File.read(file), nil, '-').result(binding)
184
+ begin
185
+ file = File.join(File.dirname(__FILE__),"templates/#{template}")
186
+ ERB.new(File.read(file), nil, '-').result(binding)
187
+ rescue StandardError => e
188
+ fail "Processing #{@registry[:file]}:#{@registry[:line]} with #{file} => #{e}"
189
+ end
163
190
  end
164
191
 
165
192
  private
@@ -1,18 +1,36 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/markdown/base'
2
4
 
3
5
  module PuppetStrings::Markdown
4
6
  # This class encapsualtes ruby data types and puppet type aliases
5
7
  class DataType < Base
6
8
  attr_reader :alias_of
9
+ attr_reader :functions
7
10
 
8
11
  def initialize(registry)
9
12
  @template = 'data_type.erb'
10
13
  super(registry, 'data type')
11
14
  @alias_of = registry[:alias_of] unless registry[:alias_of].nil?
15
+ @functions = @registry[:functions].nil? ? nil : @registry[:functions].map { |func| DataType::Function.new(func) }
12
16
  end
13
17
 
14
18
  def render
15
19
  super(@template)
16
20
  end
17
21
  end
22
+
23
+ class DataType::Function < Base
24
+ def initialize(registry)
25
+ super(registry, 'data_type_function')
26
+ end
27
+
28
+ def render
29
+ super('data_type_function.erb')
30
+ end
31
+
32
+ def signature
33
+ @registry[:signature]
34
+ end
35
+ end
18
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'data_type'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -22,7 +24,7 @@ module PuppetStrings::Markdown
22
24
  def self.render
23
25
  final = in_dtypes.length > 0 ? "## Data types\n\n" : ""
24
26
  in_dtypes.each do |type|
25
- final << type.render unless type.private?
27
+ final += type.render unless type.private?
26
28
  end
27
29
  final
28
30
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/markdown/base'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'defined_type'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -19,7 +21,7 @@ module PuppetStrings::Markdown
19
21
  def self.render
20
22
  final = in_dtypes.length > 0 ? "## Defined types\n\n" : ""
21
23
  in_dtypes.each do |type|
22
- final << type.render unless type.private?
24
+ final += type.render unless type.private?
23
25
  end
24
26
  final
25
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/markdown/base'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -19,23 +21,23 @@ module PuppetStrings::Markdown
19
21
 
20
22
  def type
21
23
  t = @registry[:type]
22
- if t =~ /ruby4x/
24
+ if /ruby4x/.match?(t)
23
25
  "Ruby 4.x API"
24
- elsif t =~ /ruby3/
26
+ elsif /ruby3/.match?(t)
25
27
  "Ruby 3.x API"
26
- elsif t =~ /ruby/
28
+ elsif /ruby/.match?(t)
27
29
  "Ruby"
28
30
  else
29
31
  "Puppet Language"
30
32
  end
31
33
  end
32
34
 
33
- def error_type(r) # rubocop:disable Naming/UncommunicativeMethodParamName
34
- "`#{r.split(' ')[0]}`"
35
+ def error_type(type)
36
+ "`#{type.split(' ')[0]}`"
35
37
  end
36
38
 
37
- def error_text(r) # rubocop:disable Naming/UncommunicativeMethodParamName
38
- "#{r.split(' ').drop(1).join(' ')}"
39
+ def error_text(text)
40
+ "#{text.split(' ').drop(1).join(' ')}"
39
41
  end
40
42
  end
41
43
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'function'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -19,7 +21,7 @@ module PuppetStrings::Markdown
19
21
  def self.render
20
22
  final = in_functions.length > 0 ? "## Functions\n\n" : ""
21
23
  in_functions.each do |func|
22
- final << func.render unless func.private?
24
+ final += func.render unless func.private?
23
25
  end
24
26
  final
25
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/markdown/base'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'puppet_class'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -19,7 +21,7 @@ module PuppetStrings::Markdown
19
21
  def self.render
20
22
  final = in_classes.length > 0 ? "## Classes\n\n" : ""
21
23
  in_classes.each do |klass|
22
- final << klass.render unless klass.private?
24
+ final += klass.render unless klass.private?
23
25
  end
24
26
  final
25
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/markdown/base'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'puppet_plan'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -19,7 +21,7 @@ module PuppetStrings::Markdown
19
21
  def self.render
20
22
  final = in_plans.length > 0 ? "## Plans\n\n" : ""
21
23
  in_plans.each do |plan|
22
- final << plan.render unless plan.private?
24
+ final += plan.render unless plan.private?
23
25
  end
24
26
  final
25
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/markdown/base'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'puppet_task'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -16,7 +18,7 @@ module PuppetStrings::Markdown
16
18
  def self.render
17
19
  final = in_tasks.length > 0 ? "## Tasks\n\n" : ""
18
20
  in_tasks.each do |task|
19
- final << task.render unless task.private?
21
+ final += task.render unless task.private?
20
22
  end
21
23
  final
22
24
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/markdown/base'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -12,11 +14,28 @@ module PuppetStrings::Markdown
12
14
  end
13
15
 
14
16
  def properties
15
- @registry[:properties]
17
+ return nil unless @registry[:properties]
18
+
19
+ @registry[:properties].sort_by { |p| p[:name] }
20
+ end
21
+
22
+ def checks
23
+ return nil unless @registry[:checks]
24
+
25
+ @registry[:checks].sort_by { |p| p[:name] }
26
+ end
27
+
28
+ # "checks" (such as "onlyif" or "creates") are another type of property
29
+ def properties_and_checks
30
+ return nil if properties.nil? && checks.nil?
31
+
32
+ ((properties || []) + (checks || [])).sort_by { |p| p[:name] }
16
33
  end
17
34
 
18
35
  def parameters
19
- @registry[:parameters]
36
+ return nil unless @registry[:parameters]
37
+
38
+ @registry[:parameters].sort_by { |p| p[:name] }
20
39
  end
21
40
 
22
41
  def regex_in_data_type?(data_type)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource_type'
2
4
 
3
5
  module PuppetStrings::Markdown
@@ -19,7 +21,7 @@ module PuppetStrings::Markdown
19
21
  def self.render
20
22
  final = in_rtypes.length > 0 ? "## Resource types\n\n" : ""
21
23
  in_rtypes.each do |type|
22
- final << type.render unless type.private?
24
+ final += type.render unless type.private?
23
25
  end
24
26
  final
25
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PuppetStrings::Markdown
2
4
  module TableOfContents
3
5
  def self.render
@@ -16,7 +18,7 @@ module PuppetStrings::Markdown
16
18
  priv = r.contains_private?
17
19
 
18
20
  template = File.join(File.dirname(__FILE__),"templates/table_of_contents.erb")
19
- final << ERB.new(File.read(template), nil, '-').result(binding)
21
+ final += ERB.new(File.read(template), nil, '-').result(binding)
20
22
  end
21
23
  final
22
24
  end
@@ -1,4 +1,4 @@
1
- ### <%= name %>
1
+ ### <a name="<%= link %>"></a>`<%= name %>`
2
2
 
3
3
  <% if text -%>
4
4
  <%= text %>
@@ -24,10 +24,10 @@
24
24
  * **See also**
25
25
  <% see.each do |sa| -%>
26
26
  <% if sa[:name] -%>
27
- <%= sa[:name] %>
27
+ <%= " * #{sa[:name]}" %>
28
28
  <% end -%>
29
29
  <% if sa[:text] -%>
30
- <%= sa[:text] %>
30
+ <%= " * #{sa[:text]}" %>
31
31
  <% end -%>
32
32
  <% end -%>
33
33
 
@@ -47,10 +47,14 @@
47
47
  <% if params -%>
48
48
  #### Parameters
49
49
 
50
- The following parameters are available in the `<%= name %>` <%= @type %>.
50
+ The following parameters are available in the `<%= name %>` <%= @type %>:
51
51
 
52
52
  <% params.each do |param| -%>
53
- ##### `<%= param[:name] %>`
53
+ * [`<%= param[:name] %>`](#<%= param[:name] %>)
54
+ <% end -%>
55
+
56
+ <% params.each do |param| -%>
57
+ ##### <a name="<%= param[:name] %>"></a>`<%= param[:name] %>`
54
58
 
55
59
  <% if param[:types] -%>
56
60
  Data type: `<%= param[:types].join(', ') -%>`
@@ -65,9 +69,17 @@ Options:
65
69
  * **<%= o[:opt_name] %>** `<%= o[:opt_types][0] %>`: <%= o[:opt_text] %>
66
70
  <% end -%>
67
71
 
72
+ <% end -%>
73
+ <% if enums_for_param(param[:name]) -%>
74
+ Options:
75
+
76
+ <% enums_for_param(param[:name]).each do |e| -%>
77
+ * **<%= e[:opt_name] %>**: <%= e[:opt_text] %>
78
+ <% end -%>
79
+
68
80
  <% end -%>
69
81
  <% if defaults && defaults[param[:name]] -%>
70
- Default value: <%= value_string(defaults[param[:name]]) %>
82
+ Default value: `<%= value_string(defaults[param[:name]]) %>`
71
83
 
72
84
  <% end -%>
73
85
  <% end -%>
@@ -1,4 +1,4 @@
1
- ### <%= name %>
1
+ ### <a name="<%= link %>"></a>`<%= name %>`
2
2
 
3
3
  <% if text -%>
4
4
  <%= text %>
@@ -24,10 +24,10 @@
24
24
  * **See also**
25
25
  <% see.each do |sa| -%>
26
26
  <% if sa[:name] -%>
27
- <%= sa[:name] %>
27
+ <%= " * #{sa[:name]}" %>
28
28
  <% end -%>
29
29
  <% if sa[:text] -%>
30
- <%= sa[:text] %>
30
+ <%= " * #{sa[:text]}" %>
31
31
  <% end -%>
32
32
  <% end -%>
33
33
 
@@ -45,16 +45,24 @@
45
45
  <% end -%>
46
46
  <% end -%>
47
47
  <% if alias_of -%>
48
- Alias of `<%= alias_of %>`
48
+ Alias of
49
+
50
+ ```puppet
51
+ <%= alias_of %>
52
+ ```
49
53
 
50
54
  <% end -%>
51
55
  <% if params -%>
52
56
  #### Parameters
53
57
 
54
- The following parameters are available in the `<%= name %>` <%= @type %>.
58
+ The following parameters are available in the `<%= name %>` <%= @type %>:
55
59
 
56
60
  <% params.each do |param| -%>
57
- ##### `<%= param[:name] %>`
61
+ * [`<%= param[:name] %>`](#<%= param[:name] %>)
62
+ <% end -%>
63
+
64
+ <% params.each do |param| -%>
65
+ ##### <a name="<%= param[:name] %>"></a>`<%= param[:name] %>`
58
66
 
59
67
  <% if param[:types] -%>
60
68
  Data type: `<%= param[:types].join(', ') -%>`
@@ -69,10 +77,25 @@ Options:
69
77
  * **<%= o[:opt_name] %>** `<%= o[:opt_types][0] %>`: <%= o[:opt_text] %>
70
78
  <% end -%>
71
79
 
80
+ <% end -%>
81
+ <% if enums_for_param(param[:name]) -%>
82
+ Options:
83
+
84
+ <% enums_for_param(param[:name]).each do |e| -%>
85
+ * **<%= e[:opt_name] %>**: <%= e[:opt_text] %>
86
+ <% end -%>
87
+
72
88
  <% end -%>
73
89
  <% if defaults && defaults[param[:name]] -%>
74
- Default value: <%= value_string(defaults[param[:name]]) %>
90
+ Default value: `<%= value_string(defaults[param[:name]]) %>`
75
91
 
76
92
  <% end -%>
77
93
  <% end -%>
78
94
  <% end -%>
95
+ <% if functions -%>
96
+ #### Functions
97
+
98
+ The following functions are available in the `<%= name %>` <%= @type %>.
99
+
100
+ <% functions.each do |func| -%><%= func.render -%><% end -%>
101
+ <% end -%>