Raku / Pod-To-HTML

Convert Raku docs to shiny HTML
Artistic License 2.0
12 stars 19 forks source link

Make TOC inclusion optional #62

Closed uzluisf closed 4 years ago

uzluisf commented 5 years ago

Right now, a table of content is always included in the output HTML. Although it could possibly be hidden using CSS (?), I think a better strategy is to include it conditionally.

I got something working on my local copy of the module but I'm afraid it might be too simplistic:

sub pod2html(
    ...    
    :$toc = False,
    ...
) { ... }

return $main-tm.render(
        ...
        :toc( $toc ?? do-toc($pod) !! Nil ),
        ...
) { ... }
JJ commented 5 years ago

Good idea! We'll see what can be done.

uzluisf commented 4 years ago

I wish I had realized this sooner but Pod::To::HTML supplying the Mustache renderer with the toc template variable is the most sane option; thus no need to make toc inclusion optional via a routine (e.g., render). It's only a matter of using another Mustache template that doesn't use the toc template variable.