puppet-strings 2.2.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +87 -1
  3. data/CONTRIBUTING.md +32 -2
  4. data/README.md +81 -17
  5. data/lib/puppet-strings.rb +5 -3
  6. data/lib/puppet-strings/describe.rb +2 -0
  7. data/lib/puppet-strings/json.rb +4 -0
  8. data/lib/puppet-strings/markdown.rb +13 -9
  9. data/lib/puppet-strings/markdown/base.rb +30 -3
  10. data/lib/puppet-strings/markdown/data_type.rb +36 -0
  11. data/lib/puppet-strings/markdown/data_types.rb +43 -0
  12. data/lib/puppet-strings/markdown/defined_type.rb +2 -0
  13. data/lib/puppet-strings/markdown/defined_types.rb +3 -1
  14. data/lib/puppet-strings/markdown/function.rb +9 -7
  15. data/lib/puppet-strings/markdown/functions.rb +3 -1
  16. data/lib/puppet-strings/markdown/puppet_class.rb +2 -0
  17. data/lib/puppet-strings/markdown/puppet_classes.rb +3 -1
  18. data/lib/puppet-strings/markdown/puppet_plan.rb +2 -0
  19. data/lib/puppet-strings/markdown/puppet_plans.rb +3 -1
  20. data/lib/puppet-strings/markdown/puppet_task.rb +2 -0
  21. data/lib/puppet-strings/markdown/puppet_tasks.rb +3 -1
  22. data/lib/puppet-strings/markdown/resource_type.rb +21 -2
  23. data/lib/puppet-strings/markdown/resource_types.rb +3 -1
  24. data/lib/puppet-strings/markdown/table_of_contents.rb +4 -1
  25. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +18 -6
  26. data/lib/puppet-strings/markdown/templates/data_type.erb +101 -0
  27. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  28. data/lib/puppet-strings/markdown/templates/function.erb +10 -1
  29. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  30. data/lib/puppet-strings/markdown/templates/resource_type.erb +35 -13
  31. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +6 -6
  32. data/lib/puppet-strings/monkey_patches/display_object_command.rb +2 -0
  33. data/lib/puppet-strings/tasks.rb +2 -0
  34. data/lib/puppet-strings/tasks/generate.rb +5 -2
  35. data/lib/puppet-strings/tasks/gh_pages.rb +3 -0
  36. data/lib/puppet-strings/version.rb +3 -1
  37. data/lib/puppet-strings/yard.rb +19 -0
  38. data/lib/puppet-strings/yard/code_objects.rb +4 -0
  39. data/lib/puppet-strings/yard/code_objects/base.rb +2 -0
  40. data/lib/puppet-strings/yard/code_objects/class.rb +5 -3
  41. data/lib/puppet-strings/yard/code_objects/data_type.rb +102 -0
  42. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +60 -0
  43. data/lib/puppet-strings/yard/code_objects/defined_type.rb +5 -3
  44. data/lib/puppet-strings/yard/code_objects/function.rb +9 -6
  45. data/lib/puppet-strings/yard/code_objects/group.rb +3 -0
  46. data/lib/puppet-strings/yard/code_objects/plan.rb +5 -3
  47. data/lib/puppet-strings/yard/code_objects/provider.rb +6 -0
  48. data/lib/puppet-strings/yard/code_objects/task.rb +3 -1
  49. data/lib/puppet-strings/yard/code_objects/type.rb +49 -5
  50. data/lib/puppet-strings/yard/handlers.rb +4 -0
  51. data/lib/puppet-strings/yard/handlers/helpers.rb +2 -0
  52. data/lib/puppet-strings/yard/handlers/json/base.rb +2 -0
  53. data/lib/puppet-strings/yard/handlers/json/task_handler.rb +2 -0
  54. data/lib/puppet-strings/yard/handlers/puppet/base.rb +3 -0
  55. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +2 -0
  56. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +26 -0
  57. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +2 -0
  58. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +3 -1
  59. data/lib/puppet-strings/yard/handlers/puppet/plan_handler.rb +2 -0
  60. data/lib/puppet-strings/yard/handlers/ruby/base.rb +7 -2
  61. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +409 -0
  62. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +9 -9
  63. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +13 -0
  64. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +6 -3
  65. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +25 -12
  66. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +6 -3
  67. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +18 -1
  68. data/lib/puppet-strings/yard/parsers.rb +2 -0
  69. data/lib/puppet-strings/yard/parsers/json/parser.rb +3 -1
  70. data/lib/puppet-strings/yard/parsers/json/task_statement.rb +2 -0
  71. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +11 -2
  72. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +29 -0
  73. data/lib/puppet-strings/yard/tags.rb +4 -0
  74. data/lib/puppet-strings/yard/tags/enum_tag.rb +14 -0
  75. data/lib/puppet-strings/yard/tags/factory.rb +18 -0
  76. data/lib/puppet-strings/yard/tags/overload_tag.rb +5 -2
  77. data/lib/puppet-strings/yard/tags/parameter_directive.rb +5 -4
  78. data/lib/puppet-strings/yard/tags/property_directive.rb +5 -4
  79. data/lib/puppet-strings/yard/tags/summary_tag.rb +2 -0
  80. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  81. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  82. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  83. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  84. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  85. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  86. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
  87. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  88. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  89. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +13 -0
  90. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  91. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  92. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  93. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  94. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  95. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  96. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  97. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  98. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  99. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  100. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  101. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  102. data/lib/puppet-strings/yard/templates/default/puppet_function/html/setup.rb +1 -1
  103. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +3 -1
  104. data/lib/puppet-strings/yard/templates/default/tags/html/enum.erb +17 -0
  105. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +7 -0
  106. data/lib/puppet-strings/yard/util.rb +7 -4
  107. data/lib/puppet/application/strings.rb +2 -0
  108. data/lib/puppet/face/strings.rb +7 -4
  109. data/lib/puppet/feature/rgen.rb +2 -0
  110. data/lib/puppet/feature/yard.rb +2 -0
  111. metadata +35 -45
  112. data/Gemfile +0 -38
  113. data/HISTORY.md +0 -218
  114. data/JSON.md +0 -802
  115. data/Rakefile +0 -98
  116. data/codecov.yml +0 -3
  117. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  118. data/spec/acceptance/emit_json_options.rb +0 -71
  119. data/spec/acceptance/generate_markdown_spec.rb +0 -49
  120. data/spec/acceptance/lib/util.rb +0 -163
  121. data/spec/acceptance/running_strings_generate.rb +0 -54
  122. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  123. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  124. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  125. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  126. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  127. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  128. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  129. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -6
  130. data/spec/fixtures/unit/markdown/output.md +0 -508
  131. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -542
  132. data/spec/spec_helper.rb +0 -46
  133. data/spec/spec_helper_acceptance.rb +0 -28
  134. data/spec/unit/puppet-strings/describe_spec.rb +0 -141
  135. data/spec/unit/puppet-strings/json_spec.rb +0 -283
  136. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  137. data/spec/unit/puppet-strings/markdown_spec.rb +0 -296
  138. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  139. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -116
  140. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  141. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  142. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  143. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -729
  144. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -139
  145. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -235
  146. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -295
  147. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -72
  148. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  149. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -209
  150. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'puppet-strings/markdown/base'
4
+
5
+ module PuppetStrings::Markdown
6
+ # This class encapsualtes ruby data types and puppet type aliases
7
+ class DataType < Base
8
+ attr_reader :alias_of
9
+ attr_reader :functions
10
+
11
+ def initialize(registry)
12
+ @template = 'data_type.erb'
13
+ super(registry, 'data type')
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) }
16
+ end
17
+
18
+ def render
19
+ super(@template)
20
+ end
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
36
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'data_type'
4
+
5
+ module PuppetStrings::Markdown
6
+ module DataTypes
7
+
8
+ # @return [Array] list of data types
9
+ def self.in_dtypes
10
+ arr = YARD::Registry.all(:puppet_data_type).map!(&:to_hash)
11
+ arr.concat(YARD::Registry.all(:puppet_data_type_alias).map!(&:to_hash))
12
+
13
+ arr.sort! { |a,b| a[:name] <=> b[:name] }
14
+ arr.map! { |a| PuppetStrings::Markdown::DataType.new(a) }
15
+ end
16
+
17
+ def self.contains_private?
18
+ result = false
19
+ unless in_dtypes.nil?
20
+ in_dtypes.find { |type| type.private? }.nil? ? false : true
21
+ end
22
+ end
23
+
24
+ def self.render
25
+ final = in_dtypes.length > 0 ? "## Data types\n\n" : ""
26
+ in_dtypes.each do |type|
27
+ final += type.render unless type.private?
28
+ end
29
+ final
30
+ end
31
+
32
+
33
+ def self.toc_info
34
+ final = ["Data types"]
35
+
36
+ in_dtypes.each do |type|
37
+ final.push(type.toc_info)
38
+ end
39
+
40
+ final
41
+ end
42
+ end
43
+ 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)
34
- "`#{r.split(' ')[0]}`"
35
+ def error_type(type)
36
+ "`#{type.split(' ')[0]}`"
35
37
  end
36
38
 
37
- def error_text(r)
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
@@ -7,6 +9,7 @@ module PuppetStrings::Markdown
7
9
  PuppetStrings::Markdown::DefinedTypes,
8
10
  PuppetStrings::Markdown::ResourceTypes,
9
11
  PuppetStrings::Markdown::Functions,
12
+ PuppetStrings::Markdown::DataTypes,
10
13
  PuppetStrings::Markdown::PuppetTasks,
11
14
  PuppetStrings::Markdown::PuppetPlans].each do |r|
12
15
  toc = r.toc_info
@@ -15,7 +18,7 @@ module PuppetStrings::Markdown
15
18
  priv = r.contains_private?
16
19
 
17
20
  template = File.join(File.dirname(__FILE__),"templates/table_of_contents.erb")
18
- final << ERB.new(File.read(template), nil, '-').result(binding)
21
+ final += ERB.new(File.read(template), nil, '-').result(binding)
19
22
  end
20
23
  final
21
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 -%>
@@ -0,0 +1,101 @@
1
+ ### <a name="<%= link %>"></a>`<%= name %>`
2
+
3
+ <% if text -%>
4
+ <%= text %>
5
+ <% elsif summary -%>
6
+ <%= summary %>
7
+ <% else -%>
8
+ <%= "The #{name} data type." %>
9
+ <% end -%>
10
+
11
+ <% if todo -%>
12
+ * **TODO** <%= todo %>
13
+
14
+ <% end -%>
15
+ <% if note -%>
16
+ * **Note** <%= note %>
17
+
18
+ <% end -%>
19
+ <% if since -%>
20
+ * **Since** <%= since %>
21
+
22
+ <% end -%>
23
+ <% if see -%>
24
+ * **See also**
25
+ <% see.each do |sa| -%>
26
+ <% if sa[:name] -%>
27
+ <%= " * #{sa[:name]}" %>
28
+ <% end -%>
29
+ <% if sa[:text] -%>
30
+ <%= " * #{sa[:text]}" %>
31
+ <% end -%>
32
+ <% end -%>
33
+
34
+ <% end -%>
35
+ <% if examples -%>
36
+ #### Examples
37
+
38
+ <% examples.each do |eg| -%>
39
+ ##### <%= eg[:name] %>
40
+
41
+ ```puppet
42
+ <%= eg[:text] %>
43
+ ```
44
+
45
+ <% end -%>
46
+ <% end -%>
47
+ <% if alias_of -%>
48
+ Alias of
49
+
50
+ ```puppet
51
+ <%= alias_of %>
52
+ ```
53
+
54
+ <% end -%>
55
+ <% if params -%>
56
+ #### Parameters
57
+
58
+ The following parameters are available in the `<%= name %>` <%= @type %>:
59
+
60
+ <% params.each do |param| -%>
61
+ * [`<%= param[:name] %>`](#<%= param[:name] %>)
62
+ <% end -%>
63
+
64
+ <% params.each do |param| -%>
65
+ ##### <a name="<%= param[:name] %>"></a>`<%= param[:name] %>`
66
+
67
+ <% if param[:types] -%>
68
+ Data type: `<%= param[:types].join(', ') -%>`
69
+
70
+ <% end -%>
71
+ <%= param[:text] %>
72
+
73
+ <% if options_for_param(param[:name]) -%>
74
+ Options:
75
+
76
+ <% options_for_param(param[:name]).each do |o| -%>
77
+ * **<%= o[:opt_name] %>** `<%= o[:opt_types][0] %>`: <%= o[:opt_text] %>
78
+ <% end -%>
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
+
88
+ <% end -%>
89
+ <% if defaults && defaults[param[:name]] -%>
90
+ Default value: `<%= value_string(defaults[param[:name]]) %>`
91
+
92
+ <% end -%>
93
+ <% end -%>
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 -%>