GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MojoMojo::Formatter::TOC(3) User Contributed Perl Documentation MojoMojo::Formatter::TOC(3)

Return true if the module is loaded.

MojoMojo::Formatter::TOC - generate table of contents

This formatter will replace "{{toc}}" with a table of contents, using HTML::GenToc. If you don't want an element to be included in the TOC, make it have "class="notoc""

The TOC formatter expects HTML input so it needs to run after the main formatter. Since comment-type formatters (order 91) could add a heading for the comment section, the TOC formatter will run with a priority of 95.

Calls the formatter. Takes a ref to the content as well as the context object. The syntax for the TOC plugin invocation is:

  {{toc M- }}     # start from Header level M
  {{toc -N }}     # stop at Header level N
  {{toc M-N }}    # process only header levels M..N

where M is the minimum heading level to include in the TOC, and N is the maximum level (depth). For example, suppose you only have one H1 on the page so it doesn't make sense to add it to the TOC; also, assume you and don't want to include any headers smaller than H3. The {{toc}} markup to achieve that would be:

  {{toc 2-3}}

Defaults to 1-6.

Anchors should be generated with SEO- (and human-) friendly names, i.e. out of the entire token text, instead of being numeric or reduced to the first word(s) of the token. In the spirit of http://seo2.0.onreact.com/top-10-fatal-url-design-mistakes, compare:

  http://beachfashion.com/photos/Pamela_Anderson#In_red_swimsuit_in_Baywatch
    vs.
  http://beachfashion.com/photos/Pamela_Anderson#in

"Which one speaks your language more, which one will you rather click?"

The anchor names generated are compliant with XHTML1.0 Strict. Also, per the HTML 4.01 spec, anchor names should be restricted to ASCII characters and anchors that differ only in case may not appear in the same document. In particular, an anchor name may be defined only once in a document (logically, because otherwise the user agent wouldn't know which #foo to scroll to). This is currently a problem with HTML::Toc v1.11, which doesn't have support for passing the already existing anchors to the "templateAnchorName" sub.

 http://search.cpan.org/dist/HTML-Toc/Toc.pod#templateAnchorName

MojoMojo and Module::Pluggable::Ordered.

Dan Dascalescu, <http://dandascalescu.com>

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
2016-12-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.