From 73ef808572aa65e127a6f8f57d6dae5e3de69011 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 1 May 2020 22:25:27 -0700 Subject: Split the descriptions and notes out This fixes a few resources that included notes Signed-off-by: Tim Smith --- tasks/docs.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'tasks') 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 -- cgit v1.2.1