From 1fae19e5aebffc1d643951b1a0570c5cd99acd19 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Mon, 5 Jan 2015 16:01:43 -0800 Subject: [PATCH] (PDOC-17) htmlify class/defined type descriptions Prior to this commit we were not calling htmlify on the docstring for the description of a puppet class on defined type. This meant that the raw string would be displayed without paying attention to any potential markdown or rdoc formatting present. Now the YARD method htmlify is being called on the docstring so that it will be displayed properly. Additionally clean up an unclear comment and fix a small bug in the way parameter information is processed. --- .../yard/templates/default/definedtype/html/docstring.erb | 2 +- .../strings/yard/templates/default/definedtype/setup.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 0f24670..edebfa0 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,6 +1,6 @@
-

<%= @class_details[:desc] %>

+

<%= htmlify(@class_details[:desc]) %>

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 13f1033..adc2778 100644 --- a/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb +++ b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb @@ -61,7 +61,7 @@ end # @option opts [String] :fq_name The fully qualified parameter name # @option opts [String] :desc The description provided in the comment # @options opts [Array] :types The parameter type(s) specified in the comment -# @options opts [Boolean] :exists? True only if the parameter actually exists and just not just defined in the comment +# @options opts [Boolean] :exists? True only if the parameter exists in the documented logic and not just in a comment def extract_param_details(params_hash, tags_hash) parameter_info = [] @@ -79,7 +79,7 @@ def extract_param_details(params_hash, tags_hash) tags_hash.each do |tag| param_exists = false parameter_info.each do |parameter| - if parameter.has_value?(tag.name) + if parameter[:name] == tag.name param_exists = true end end