Skip Menu |

This queue is for tickets about the HTML-Toc CPAN distribution.

Report information
The Basics
Id: 43801
Status: new
Priority: 0/
Queue: HTML-Toc

Owner: Nobody in particular
Requestors: ddascalescu+perl [...]

Bug Information
Severity: Unimportant
Broken in: 1.10
Fixed in: (no value)

Subject: Incorrect parsing of levelToToc regexp results in die
Download (untitled) / with headers
text/plain 268b
Setting levelToToc to "[2-10]" causes the following: Invalid [] range "2-1" in regex; marked by <-- HERE in m/[2-1 <-- HERE 0]/ at lib/HTML/ line 934. (even if there are no more than 6 heading levels, there might be a bug in how that regexp is parsed)
Subject: levelToToc.t
Download levelToToc.t
text/x-perl 887b
#!/usr/bin/perl -w use strict; use HTML::Toc; use HTML::TocInsertor; use Test::More tests => 1; use Test::Differences; my $toc = HTML::Toc->new(); my $tocInsertor = HTML::TocInsertor->new(); my $output; $toc->setOptions({ levelToToc => "[2-10]", }); # ------------------------------------------------------------------------------ # --- Should theoretically accept levelsToToc greater than 9 # ------------------------------------------------------------------------------ my $content = <<'HTML'; <h1>level 1</h1> <h2>level 2</h2> <h3>level 3</h3> <h4>level 4</h4> HTML $tocInsertor->insert($toc, $content, {output => \$output}); eq_or_diff($output, <<'HTML', 'should theoretically accept levelsToToc greater than 9', {max_width => 120}); <h1>level 1</h1> <h2><a name="h-01"></a>level 2</h2> <h3><a name="h-01.1"></a>level 3</h3> <h4><a name="h-01.1.1"></a>level 4</h4> HTML

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to