From d4ca490d1b0c205b97335b460410e851126be72a Mon Sep 17 00:00:00 2001 From: Eric Putnam Date: Tue, 3 Apr 2018 13:37:47 +0100 Subject: [PATCH] (maint) display Plans in markdown table of contents Currently, Plans are not being included in the table of contents in the markdown output. This is because Plans were not being passed to the table of contents renderer. This adds Plans to the renderer and updates tests accordingly. --- lib/puppet-strings/markdown/puppet_plans.rb | 2 +- lib/puppet-strings/markdown/table_of_contents.rb | 3 ++- spec/fixtures/unit/markdown/output_with_plan.md | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/puppet-strings/markdown/puppet_plans.rb b/lib/puppet-strings/markdown/puppet_plans.rb index 71ffa2e..fc0bd45 100644 --- a/lib/puppet-strings/markdown/puppet_plans.rb +++ b/lib/puppet-strings/markdown/puppet_plans.rb @@ -27,7 +27,7 @@ module PuppetStrings::Markdown def self.toc_info final = ["Plans"] - in_classes.each do |plan| + in_plans.each do |plan| final.push(plan.toc_info) end diff --git a/lib/puppet-strings/markdown/table_of_contents.rb b/lib/puppet-strings/markdown/table_of_contents.rb index d88e223..dd2f2a6 100644 --- a/lib/puppet-strings/markdown/table_of_contents.rb +++ b/lib/puppet-strings/markdown/table_of_contents.rb @@ -7,7 +7,8 @@ module PuppetStrings::Markdown PuppetStrings::Markdown::DefinedTypes, PuppetStrings::Markdown::ResourceTypes, PuppetStrings::Markdown::Functions, - PuppetStrings::Markdown::PuppetTasks].each do |r| + PuppetStrings::Markdown::PuppetTasks, + PuppetStrings::Markdown::PuppetPlans].each do |r| toc = r.toc_info group_name = toc.shift group = toc diff --git a/spec/fixtures/unit/markdown/output_with_plan.md b/spec/fixtures/unit/markdown/output_with_plan.md index 710cef9..b00ef0f 100644 --- a/spec/fixtures/unit/markdown/output_with_plan.md +++ b/spec/fixtures/unit/markdown/output_with_plan.md @@ -30,6 +30,10 @@ * [`(stdin)`](#(stdin)): Allows you to backup your database to local file. +## Plans + +* [`plann`](#plann): A simple plan. + ## Classes ### klass