puppetlabs / puppet-strings

The next generation Puppet documentation extraction and presentation tool.
http://puppetlabs.github.io/puppet-strings/
Apache License 2.0
90 stars 84 forks source link

(#267) Don’t show “Public X” header without contents #314

Closed danielparks closed 2 years ago

danielparks commented 2 years ago

Previously, the “Public X” header would be displayed if there were any private X regardless of whether there were any public X.

For example, having a private function would make both the “Public Functions” and “Private Functions” headers appear, even if there weren’t any public functions.

This changes it so that there are three conditions:

In other words, if there are no private Xs, then it just lists the public once. Otherwise, it splits them up under public/private headers but avoids showing a header if it’s contents will be empty.

This also radically simplifies and removes a bunch of boilerplate code around rendering these sections.

danielparks commented 2 years ago

I realized that it was a lot clearer to pull PuppetStrings::Markdown::TableOfContents into the general renderer, so I did. I also did some future-rubocop-related clean ups, though it’s still going to take some work to rebase this after #310 lands.