use Test::More tests => 1; use HTML::GenToc; #=================================================== my $toc = new HTML::GenToc(); my $input = <<'HTML';

The Big Step 1

The first heading text hoes here

The Big Step 2

This is the second heading text

second header, first subheader

Some subheader text here

second header, second subheader

Another piece of subheader text here

The Big Step

Third heading text

The Big Step

Fourth heading text; anchor above needed uniquifying

The big Step

Per http://www.w3.org/TR/REC-html40/struct/links.html#h-12.2.1, "Anchor names must be unique within a document. Anchor names that differ only in case may not appear in the same document."

The Big Step #6

The number/hash sign is allowed in fragments; the fragment starts with the first hash. No spec as a reference for this, but the anchors work in Firefox 3 and IE 6.

Calculation #7: 7/5>3 or <2?

Hash marks in fragments work, as well as '/' and '?' signs. < and > are escaped.

#8: start with a number (hash) [pound] {comment} sign

HTML my $output; =pod Test 1 --- 1. SEO-friendly anchors --------------------------------------------------------- Anchors should be generated with SEO-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, anchors that differ only in case may not appear in the same document and anchor names should be restricted to ASCII characters. =cut $output = $toc->generate_toc( input => $input, inline => 1, toc_tag => 'tochere', toc_tag_replace => 1, to_string => 1, ); my $good_output = <<'EOT';

Table of Contents

The Big Step 1

The first heading text hoes here

The Big Step 2

This is the second heading text

second header, first subheader

Some subheader text here

second header, second subheader

Another piece of subheader text here

The Big Step

Third heading text

The Big Step

Fourth heading text; anchor above needed uniquifying

The big Step

Per http://www.w3.org/TR/REC-html40/struct/links.html#h-12.2.1, "Anchor names must be unique within a document. Anchor names that differ only in case may not appear in the same document."

The Big Step #6

The number/hash sign is allowed in fragments; the fragment starts with the first hash. No spec as a reference for this, but the anchors work in Firefox 3 and IE 6.

Calculation #7: 7/5>3 or <2?

Hash marks in fragments work, as well as '/' and '?' signs. < and > are escaped.

#8: start with a number (hash) [pound] {comment} sign

EOT is($output, $good_output, "(1) SEO-friendly anchors match");