summaryrefslogtreecommitdiff
path: root/tasks
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2019-11-14 16:39:38 -0800
committerTim Smith <tsmith84@gmail.com>2019-11-14 16:39:38 -0800
commite8cf6833db1d43e1d89a1380325399b8874e3273 (patch)
tree17fc7a6379a49ec6d560dcdc4c4fe8a1ae13c8bb /tasks
parent1829110104757c8fbc79f5e851e9135f99ec2163 (diff)
downloadchef-e8cf6833db1d43e1d89a1380325399b8874e3273.tar.gz
Improve resource descriptions and the rake task for docs generation
Bring in a few more copy edits that were done on the website and improve the rake task so that it better creates docs that match the formatting we want. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'tasks')
-rwxr-xr-xtasks/docs.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/tasks/docs.rb b/tasks/docs.rb
index 8fa56e9e09..643eaee7a6 100755
--- a/tasks/docs.rb
+++ b/tasks/docs.rb
@@ -24,7 +24,9 @@ namespace :docs_site do
return nil if default.nil? || default == "" || default == "lazy default"
if default.is_a?(String)
- return default.inspect unless default[0] == ":"
+
+ # .inspect wraps the value in quotes which we want for strings, but not sentences or symbols as strings
+ return default.inspect unless default[0] == ":" || default.end_with?('.')
end
default
end
@@ -101,7 +103,13 @@ namespace :docs_site do
def bolded_description(name, description)
return nil if description.nil? # handle resources missing descriptions
- description.gsub( "#{name} ", "**#{name}** ").split("Note: ").first.strip
+ # we only want to bold occurences of the resource name in the first 5 words so treat it as an array
+ desc_array = description.split(" ")
+
+ desc_array = desc_array[0..4].map! { |x| name == x ? "**#{x}**" : x } + desc_array[5..-1]
+
+ # strip out notes and return just the description
+ desc_array.join(" ").split("Note: ").first.strip
end
def note_text(description)