summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-05-01 22:25:27 -0700
committerTim Smith <tsmith84@gmail.com>2020-05-01 22:25:27 -0700
commit73ef808572aa65e127a6f8f57d6dae5e3de69011 (patch)
treee759aa13458f1303cf49f69d4c493909999adb28
parentacadeb98d481a8ba298813a316b6d8168343ee27 (diff)
downloadchef-73ef808572aa65e127a6f8f57d6dae5e3de69011.tar.gz
Split the descriptions and notes out
This fixes a few resources that included notes Signed-off-by: Tim Smith <tsmith@chef.io>
-rwxr-xr-xtasks/docs.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/tasks/docs.rb b/tasks/docs.rb
index 08fca72bc8..f0aff0e32a 100755
--- a/tasks/docs.rb
+++ b/tasks/docs.rb
@@ -112,18 +112,18 @@ namespace :docs_site do
fixed_arr.compact.join(", ")
end
+ # split out notes from the description field. We didn't design a note syntax so we stick them in there
def note_text(description)
return nil if description.nil?
- note = description.split("Note: ")[1]
- if note
- <<-HEREDOC
+ description.split("Note: ")[1]
+ end
- .. note::
+ # Returns description without embedded notes that may be present
+ def description_text(description)
+ return nil if description.nil?
- #{note}
- HEREDOC
- end
+ description.split(" Note:")[0]
end
# build the menu entry for this resource
@@ -267,7 +267,11 @@ namespace :docs_site do
r["aliases"] = ["/resource_#{name}.html"]
r["menu"] = build_menu_item(name)
r["resource_description_list"] = {}
- r["resource_description_list"] = [{ "markdown" => data["description"] }]
+ r["resource_description_list"] = [{ "markdown" => description_text(data["description"]) }]
+
+ # if the description contained a note then add it
+ r["resource_description_list"] << { "note" => { "markdown" => note_text(data["description"]) } } unless note_text(data["description"]).nil?
+
r["resource_new_in"] = data["introduced"] unless data["introduced"].nil?
r["syntax_full_code_block"] = generate_resource_block(name, properties, data["default_action"])
r["syntax_properties_list"] = nil