%#
Table of Contents
-%>
2
<%#
Parse classes
-%>
<%- if @data['puppet_classes'].any? -%>
Classes
<%- @data['puppet_classes'].each do |puppet_class| -%>
<%= puppet_class['name'] %>
<%- if puppet_class['docstring']['tags'] -%>
<%= h(puppet_class['docstring']['text']).gsub("\n\n", "
\n") %>
<%- api = puppet_class['docstring']['tags'].select { |a| a['tag_name'].eql? 'api' } -%>
<%- if api.any? and api[0]['text'].eql? 'private' -%>
This class is private. It's intended solely for internal module usage.
<%- end -%>
<%- for tag in puppet_class['docstring']['tags'] -%>
<%- unless %w(param example api).include? tag['tag_name'] -%>
<%= tag['tag_name'].capitalize %>
<%= h tag['name'] %> <%= h tag['text'] %>
<%- end -%>
<%- end -%>
<%- params = puppet_class['docstring']['tags'].select { |a| a['tag_name'].eql? 'param' } -%>
<%- if params.any? -%>
Parameters
<%- for param in params -%>
<%= Strings2conf::Util::parse_param(puppet_class, param) %>
<%- end -%>
<%- end -%>
<%- examples = puppet_class['docstring']['tags'].select { |a| a['tag_name'].eql? 'example' } -%>
<%- if examples.any? -%>
Examples
<%- examples.each do |example| -%>
<%= Strings2conf::Util::code_block(example['text'], title: example['name'], language: :ruby) -%>
<%- end -%>
<%- end -%>
<%- end -%>
<%= Strings2conf::Util::code_block(puppet_class['source'], title: puppet_class['file'], collapse: true, language: :ruby) -%>
<%- end -%>
<%- end -%>
<%#
Parse defined types
-%>
<%- if @data['defined_types'].any? -%>
Defined Types
<%- @data['defined_types'].each do |defined_type| -%>
<%= defined_type['name'] %>
<%- if defined_type['docstring']['tags'] -%>
<%= h(defined_type['docstring']['text']).gsub("\n\n", "
\n") %>
<%- api = defined_type['docstring']['tags'].select { |a| a['tag_name'].eql? 'api' } -%>
<%- if api.any? and api[0]['text'].eql? 'private' -%>
This defined type is private. It's intended solely for internal module usage.
<%- end -%>
<%- for tag in defined_type['docstring']['tags'] -%>
<%- unless %w(param example api).include? tag['tag_name'] -%>
<%= tag['tag_name'].capitalize %>
<%= h tag['name'] %> <%= h tag['text'] %>
<%- end -%>
<%- end -%>
<%- params = defined_type['docstring']['tags'].select { |a| a['tag_name'].eql? 'param' } -%>
<%- if params.any? -%>
Parameters
<%- for param in params -%>
<%= Strings2conf::Util::parse_param(defined_type, param) %>
<%- end -%>
<%- end -%>
<%- examples = defined_type['docstring']['tags'].select { |a| a['tag_name'].eql? 'example' } -%>
<%- if examples.any? -%>
Examples
<%- examples.each do |example| -%>
<%= Strings2conf::Util::code_block(example['text'], title: example['name'], language: :ruby) -%>
<%- end -%>
<%- end -%>
<%- end -%>
<%= Strings2conf::Util::code_block(defined_type['source'], title: defined_type['file'], collapse: true, language: :ruby) -%>
<%- end -%>
<%- end -%>
<%#
Parse functions
-%>
<%- if @data['puppet_functions'].any? -%>
Functions
<%- @data['puppet_functions'].each do |puppet_function| -%>
<%= puppet_function['name'] %>
<%= h(puppet_function['docstring']['text']).gsub("\n\n", "
\n") %>
<%-
tags = puppet_function['docstring']['tags']
examples = tags.select { |a| a['tag_name'].eql? 'example' }
overloads = tags.select { |a| a['tag_name'].eql? 'overload' }
-%>
<%- if overloads.any? -%>
<%- overloads.each_with_index do |overload, index| -%>
Signature #<%= index + 1 %>
<%= Strings2conf::Util::code_block(overload['signature'], language: :ruby, linenumbers: false) -%>
<%- tags = overload['docstring']['tags'] -%>
<%- params = tags.select { |a| a['tag_name'].eql? 'param' } -%>
<%- returns = tags.select { |a| a['tag_name'].eql? 'return' } -%>
<%- if params.any? -%>
Parameters
<%- params.each do |param| -%>
<%= Strings2conf::Util::parse_param(overload, param) %>
<%- end -%>
<%- end -%>
<%- if returns.any? -%>
Returns
<%- returns.each do |ret| -%>
[ <%= ret['types'].join(',') %>
] <%= ret['text'] %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- else -%>
<%- params = tags.select { |a| a['tag_name'].eql? 'param' } -%>
<%- returns = tags.select { |a| a['tag_name'].eql? 'return' } -%>
<%- if params.any? -%>
Parameters
<%- params.each do |param| -%>
<%= Strings2conf::Util::parse_param(puppet_function, param) %>
<%- end -%>
<%- end -%>
<%- if returns.any? -%>
Returns
<%- returns.each do |ret| -%>
[ <%= ret['types'].join(',') %>
] <%= ret['text'] %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- if examples.any? -%>
Examples
<%- examples.each do |example| -%>
<%= Strings2conf::Util::code_block(example['text'], title: example['name'], language: :ruby) -%>
<%- end -%>
<%- end -%>
<%= Strings2conf::Util::code_block(puppet_function['source'], title: puppet_function['file'], collapse: true, language: :ruby) -%>
<%- end -%>
<%- end -%>