puppet-strings 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -6
  3. data/lib/puppet-strings.rb +2 -0
  4. data/lib/puppet-strings/describe.rb +2 -0
  5. data/lib/puppet-strings/json.rb +2 -0
  6. data/lib/puppet-strings/markdown.rb +11 -9
  7. data/lib/puppet-strings/markdown/base.rb +11 -3
  8. data/lib/puppet-strings/markdown/data_type.rb +2 -0
  9. data/lib/puppet-strings/markdown/data_types.rb +3 -1
  10. data/lib/puppet-strings/markdown/defined_type.rb +2 -0
  11. data/lib/puppet-strings/markdown/defined_types.rb +3 -1
  12. data/lib/puppet-strings/markdown/function.rb +9 -7
  13. data/lib/puppet-strings/markdown/functions.rb +3 -1
  14. data/lib/puppet-strings/markdown/puppet_class.rb +2 -0
  15. data/lib/puppet-strings/markdown/puppet_classes.rb +3 -1
  16. data/lib/puppet-strings/markdown/puppet_plan.rb +2 -0
  17. data/lib/puppet-strings/markdown/puppet_plans.rb +3 -1
  18. data/lib/puppet-strings/markdown/puppet_task.rb +2 -0
  19. data/lib/puppet-strings/markdown/puppet_tasks.rb +3 -1
  20. data/lib/puppet-strings/markdown/resource_type.rb +2 -0
  21. data/lib/puppet-strings/markdown/resource_types.rb +3 -1
  22. data/lib/puppet-strings/markdown/table_of_contents.rb +3 -1
  23. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +7 -3
  24. data/lib/puppet-strings/markdown/templates/data_type.erb +12 -4
  25. data/lib/puppet-strings/markdown/templates/data_type_function.erb +1 -1
  26. data/lib/puppet-strings/markdown/templates/function.erb +1 -1
  27. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  28. data/lib/puppet-strings/markdown/templates/resource_type.erb +8 -2
  29. data/lib/puppet-strings/monkey_patches/display_object_command.rb +2 -0
  30. data/lib/puppet-strings/tasks.rb +2 -0
  31. data/lib/puppet-strings/tasks/generate.rb +2 -0
  32. data/lib/puppet-strings/tasks/gh_pages.rb +3 -0
  33. data/lib/puppet-strings/version.rb +3 -1
  34. data/lib/puppet-strings/yard.rb +3 -0
  35. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  36. data/lib/puppet-strings/yard/code_objects/base.rb +2 -0
  37. data/lib/puppet-strings/yard/code_objects/class.rb +4 -2
  38. data/lib/puppet-strings/yard/code_objects/data_type.rb +4 -2
  39. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +2 -0
  40. data/lib/puppet-strings/yard/code_objects/defined_type.rb +4 -2
  41. data/lib/puppet-strings/yard/code_objects/function.rb +6 -3
  42. data/lib/puppet-strings/yard/code_objects/group.rb +3 -0
  43. data/lib/puppet-strings/yard/code_objects/plan.rb +4 -2
  44. data/lib/puppet-strings/yard/code_objects/provider.rb +6 -0
  45. data/lib/puppet-strings/yard/code_objects/task.rb +2 -0
  46. data/lib/puppet-strings/yard/code_objects/type.rb +3 -0
  47. data/lib/puppet-strings/yard/handlers.rb +2 -0
  48. data/lib/puppet-strings/yard/handlers/helpers.rb +2 -0
  49. data/lib/puppet-strings/yard/handlers/json/base.rb +2 -0
  50. data/lib/puppet-strings/yard/handlers/json/task_handler.rb +2 -0
  51. data/lib/puppet-strings/yard/handlers/puppet/base.rb +3 -0
  52. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +2 -0
  53. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +2 -0
  54. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +2 -0
  55. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +3 -1
  56. data/lib/puppet-strings/yard/handlers/puppet/plan_handler.rb +2 -0
  57. data/lib/puppet-strings/yard/handlers/ruby/base.rb +5 -0
  58. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +33 -17
  59. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +9 -7
  60. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +13 -0
  61. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +4 -1
  62. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +14 -6
  63. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +5 -2
  64. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +12 -1
  65. data/lib/puppet-strings/yard/parsers.rb +2 -0
  66. data/lib/puppet-strings/yard/parsers/json/parser.rb +2 -0
  67. data/lib/puppet-strings/yard/parsers/json/task_statement.rb +2 -0
  68. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +12 -10
  69. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +4 -0
  70. data/lib/puppet-strings/yard/tags.rb +2 -0
  71. data/lib/puppet-strings/yard/tags/enum_tag.rb +2 -0
  72. data/lib/puppet-strings/yard/tags/factory.rb +2 -0
  73. data/lib/puppet-strings/yard/tags/overload_tag.rb +4 -1
  74. data/lib/puppet-strings/yard/tags/parameter_directive.rb +5 -4
  75. data/lib/puppet-strings/yard/tags/property_directive.rb +5 -4
  76. data/lib/puppet-strings/yard/tags/summary_tag.rb +2 -0
  77. data/lib/puppet-strings/yard/templates/default/puppet_function/html/setup.rb +1 -1
  78. data/lib/puppet-strings/yard/util.rb +4 -1
  79. data/lib/puppet/application/strings.rb +2 -0
  80. data/lib/puppet/face/strings.rb +4 -1
  81. data/lib/puppet/feature/rgen.rb +2 -0
  82. data/lib/puppet/feature/yard.rb +2 -0
  83. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 543437ac3fd3177245de47e563235b3f99194299f1c1cf14132bed3850de5056
4
- data.tar.gz: 4aaa21554b916ca541ae3ce04a21ab34912375499347a816292858915aa803cf
3
+ metadata.gz: 9aa1aa13861fd95a237ca2abd1ef890dfbcba1b7757c2dd609d648b803df7a33
4
+ data.tar.gz: 55d8b1903917fcd24fbb53dbe1433449a75eb88544071fdf0e2bf2d0eeb2fe11
5
5
  SHA512:
6
- metadata.gz: c73e04ec0c084f0000751eaa618ed5daa0efcfebf101e1d63832ab46403d0eff01ab628c028eae368097d2b3500c2e869d292c0fa07ad4eb68392773125b3ddf
7
- data.tar.gz: 2a40adbd4874289129cecca5164f65ce3021a83a7cc3559bd6a6b28e3154020e1a9cd5a076c119827072feb47e2f6fe562924cfd63158f4c3e924ba132e0ddcd
6
+ metadata.gz: 394ad674391503b4a894857035fbe190678bba4b264d6093935005b22322beda448fb38470ba92acedb191e1faec8dab01ccd0cc14ba807ca5b39cc6bff6b2fc
7
+ data.tar.gz: 420511c57607c8d76eb2d3e8b6417a84d3ac4247c3fc64ddd83a23fa50aba570b1e984e1a67a3c56c929c4ac8aeebf84726cd14e39ad689405ee8726281ae1dd
@@ -3,14 +3,39 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
- ## [v2.5.0](https://github.com/puppetlabs/puppet-strings/tree/v2.5.0) (2020-07-15)
6
+ ## [v2.6.0](https://github.com/puppetlabs/puppet-strings/tree/v2.6.0) (2021-01-18)
7
+
8
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.5.0...v2.6.0)
9
+
10
+ Added
11
+
12
+ - Improved markdown templates [\#252](https://github.com/puppetlabs/puppet-strings/pull/252) ([kozl](https://github.com/kozl))
13
+
14
+ Fixed
15
+
16
+ - Do not fail in case return tag has no type specified [\#268](https://github.com/puppetlabs/puppet-strings/pull/268) ([tiandrey](https://github.com/tiandrey))
17
+ - Handle a missing description gracefully [\#260](https://github.com/puppetlabs/puppet-strings/pull/260) ([scotje](https://github.com/scotje))
18
+ - Fix ERB failure - parameters without descriptions [\#255](https://github.com/puppetlabs/puppet-strings/pull/255) ([trevor-vaughan](https://github.com/trevor-vaughan))
19
+ - puppet\_function template: fix tags, source [\#249](https://github.com/puppetlabs/puppet-strings/pull/249) ([raemer](https://github.com/raemer))
20
+
21
+ Changed
22
+
23
+ - \(MAINT\) Drop Ruby 2.1.x and Puppet 4.x compatibility [\#253](https://github.com/puppetlabs/puppet-strings/pull/253) ([scotje](https://github.com/scotje))
24
+
25
+ **Closed issues:**
26
+
27
+ - Tags \(Parameter, Returns\) not generated in HTML output [\#248](https://github.com/puppetlabs/puppet-strings/issues/248)
28
+ - Can we get 2.5.0 released please [\#244](https://github.com/puppetlabs/puppet-strings/issues/244)
29
+ - Add supported\_features to puppet strings input/output for types [\#228](https://github.com/puppetlabs/puppet-strings/issues/228)
30
+ - Provider attribute is missing in generated types documentation [\#227](https://github.com/puppetlabs/puppet-strings/issues/227)
31
+
32
+ ## [v2.5.0](https://github.com/puppetlabs/puppet-strings/tree/v2.5.0) (2020-07-16)
7
33
 
8
34
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.4.0...v2.5.0)
9
35
 
10
36
  Added
11
37
 
12
38
  - \(GH-225\) Document functions in Puppet Datatypes [\#235](https://github.com/puppetlabs/puppet-strings/pull/235) ([glennsarti](https://github.com/glennsarti))
13
- - Add checks to resource\_type handler and code objects [\#232](https://github.com/puppetlabs/puppet-strings/pull/232) ([scotje](https://github.com/scotje))
14
39
  - \(\#227\) Inject `provider` into params list for types with providers [\#231](https://github.com/puppetlabs/puppet-strings/pull/231) ([scotje](https://github.com/scotje))
15
40
 
16
41
  Fixed
@@ -27,12 +52,17 @@ Fixed
27
52
  - Document usage [\#8](https://github.com/puppetlabs/puppet-strings/issues/8)
28
53
  - Need a search box on the main page [\#1](https://github.com/puppetlabs/puppet-strings/issues/1)
29
54
 
55
+ **Merged pull requests:**
56
+
57
+ - Release prep for v2.5.0 [\#245](https://github.com/puppetlabs/puppet-strings/pull/245) ([scotje](https://github.com/scotje))
58
+
30
59
  ## [v2.4.0](https://github.com/puppetlabs/puppet-strings/tree/v2.4.0) (2020-02-20)
31
60
 
32
61
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.3.1...v2.4.0)
33
62
 
34
63
  Added
35
64
 
65
+ - Add checks to resource\_type handler and code objects [\#232](https://github.com/puppetlabs/puppet-strings/pull/232) ([scotje](https://github.com/scotje))
36
66
  - Add missing HTML output support for enum tag [\#218](https://github.com/puppetlabs/puppet-strings/pull/218) ([seanmil](https://github.com/seanmil))
37
67
  - \(PDOC-295\) Add @enum tag support for Enum data types [\#215](https://github.com/puppetlabs/puppet-strings/pull/215) ([seanmil](https://github.com/seanmil))
38
68
  - Expanded default search glob for plans. [\#214](https://github.com/puppetlabs/puppet-strings/pull/214) ([Raskil](https://github.com/Raskil))
@@ -58,10 +88,6 @@ Added
58
88
 
59
89
  - Add Puppet Data Type documentation [\#199](https://github.com/puppetlabs/puppet-strings/pull/199) ([glennsarti](https://github.com/glennsarti))
60
90
 
61
- Fixed
62
-
63
- - \(PDOC-283\) Fix namespaced symbols [\#205](https://github.com/puppetlabs/puppet-strings/pull/205) ([glennsarti](https://github.com/glennsarti))
64
-
65
91
  ## [v2.2.0](https://github.com/puppetlabs/puppet-strings/tree/v2.2.0) (2019-04-05)
66
92
 
67
93
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.1.0...v2.2.0)
@@ -75,6 +101,7 @@ Added
75
101
 
76
102
  Fixed
77
103
 
104
+ - \(PDOC-283\) Fix namespaced symbols [\#205](https://github.com/puppetlabs/puppet-strings/pull/205) ([glennsarti](https://github.com/glennsarti))
78
105
  - \(PDOC-266\) Silence 'unexpected construct regexp\_literal' warning [\#189](https://github.com/puppetlabs/puppet-strings/pull/189) ([seanmil](https://github.com/seanmil))
79
106
 
80
107
  ## [v2.1.0](https://github.com/puppetlabs/puppet-strings/tree/v2.1.0) (2018-06-26)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The root module for Puppet Strings.
2
4
  module PuppetStrings
3
5
  # The glob patterns used to search for files to document.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'puppet-strings/json'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  # The module for JSON related functionality.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/json'
2
4
 
3
5
  # module for parsing Yard Registries and generating markdown
@@ -15,15 +17,15 @@ module PuppetStrings::Markdown
15
17
  # @return [String] markdown doc
16
18
  def self.generate
17
19
  final = "# Reference\n\n"
18
- final << "<!-- DO NOT EDIT: This document was generated by Puppet Strings -->\n\n"
19
- final << PuppetStrings::Markdown::TableOfContents.render
20
- final << PuppetStrings::Markdown::PuppetClasses.render
21
- final << PuppetStrings::Markdown::DefinedTypes.render
22
- final << PuppetStrings::Markdown::ResourceTypes.render
23
- final << PuppetStrings::Markdown::Functions.render
24
- final << PuppetStrings::Markdown::DataTypes.render
25
- final << PuppetStrings::Markdown::PuppetTasks.render
26
- final << PuppetStrings::Markdown::PuppetPlans.render
20
+ final += "<!-- DO NOT EDIT: This document was generated by Puppet Strings -->\n\n"
21
+ final += PuppetStrings::Markdown::TableOfContents.render
22
+ final += PuppetStrings::Markdown::PuppetClasses.render
23
+ final += PuppetStrings::Markdown::DefinedTypes.render
24
+ final += PuppetStrings::Markdown::ResourceTypes.render
25
+ final += PuppetStrings::Markdown::Functions.render
26
+ final += PuppetStrings::Markdown::DataTypes.render
27
+ final += PuppetStrings::Markdown::PuppetTasks.render
28
+ final += PuppetStrings::Markdown::PuppetPlans.render
27
29
 
28
30
  final
29
31
  end
@@ -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)
@@ -170,6 +172,8 @@ module PuppetStrings::Markdown
170
172
  end
171
173
 
172
174
  def word_wrap(text, line_width: 120, break_sequence: "\n")
175
+ return unless text
176
+
173
177
  text.split("\n").collect! do |line|
174
178
  line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1#{break_sequence}").strip : line
175
179
  end * break_sequence
@@ -177,8 +181,12 @@ module PuppetStrings::Markdown
177
181
 
178
182
  # @return [String] full markdown rendering of a component
179
183
  def render(template)
180
- file = File.join(File.dirname(__FILE__),"templates/#{template}")
181
- 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
182
190
  end
183
191
 
184
192
  private
@@ -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 '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
@@ -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 %>
@@ -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(', ') -%>`
@@ -1,4 +1,4 @@
1
- ### `<%= name %>`
1
+ ### <a name="<%= link %>"></a>`<%= name %>`
2
2
 
3
3
  <% if text -%>
4
4
  <%= text %>
@@ -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 %>:
59
+
60
+ <% params.each do |param| -%>
61
+ * [`<%= param[:name] %>`](#<%= param[:name] %>)
62
+ <% end -%>
55
63
 
56
64
  <% params.each do |param| -%>
57
- ##### `<%= param[:name] %>`
65
+ ##### <a name="<%= param[:name] %>"></a>`<%= param[:name] %>`
58
66
 
59
67
  <% if param[:types] -%>
60
68
  Data type: `<%= param[:types].join(', ') -%>`
@@ -1,4 +1,4 @@
1
- ### `<%= name %>`
1
+ ### <a name="<%= link %>"></a>`<%= name %>`
2
2
 
3
3
  #### `<%= signature %>`
4
4
 
@@ -1,4 +1,4 @@
1
- ### `<%= name %>`
1
+ ### <a name="<%= link %>"></a>`<%= name %>`
2
2
 
3
3
  Type: <%= type %>
4
4