From e85f58a64e521e7c5b7dc1778144ed3f1f631823 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Tue, 30 Dec 2014 15:19:00 -0800 Subject: [PATCH] (PDOC-17) Changed header and remove sub-header Prior to this commit there was a header and a sub-header for defined types and classes. This was a little redundant so rather than doing that, remove the sub-header and make the main header more readable. --- .../templates/default/definedtype/html/docstring.erb | 1 - .../templates/default/definedtype/html/header.erb | 5 +++++ .../yard/templates/default/definedtype/setup.rb | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb diff --git a/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb index de09fc1..0f24670 100644 --- a/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb +++ b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb @@ -1,4 +1,3 @@ -

Class: <%= @class_details[:name] %>

<%= @class_details[:desc] %>

diff --git a/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb new file mode 100644 index 0000000..74b3dba --- /dev/null +++ b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb @@ -0,0 +1,5 @@ +
+

+ <%= @header_text %> +

+
diff --git a/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb index 9da3463..13f1033 100644 --- a/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb +++ b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb @@ -17,6 +17,18 @@ def parameter_details erb(:parameter_details) end +def header + if object.type == :hostclass + @header_text = "Puppet Class: #{object.name}" + elsif object.type == :definedtype + @header_text = "Puppet Defined Type: #{object.name}" + else + @header_text = "#{object.name}" + end + + erb(:header) +end + def docstring examples = Hash.new example_tags = object.tags.find_all { |tag| tag.tag_name == "example" }