Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: HTML table-of-contents generator

by tcf22 (Priest)
on Jul 01, 2003 at 17:56 UTC ( [id://270576]=note: print w/replies, xml ) Need Help??


in reply to HTML table-of-contents generator

Don't know of any modules that build Table of Contents pages for you, but for parsing the HTML, try HTML::Parser.

Replies are listed 'Best First'.
Re: Re: HTML table-of-contents generator
by John M. Dlugosz (Monsignor) on Jul 01, 2003 at 18:47 UTC
    I would need two passes; first to identify any headers and possibly modiy them to add an id, and second to insert the generated TOC in the correct position (removing the old one).

    HTML::Parser is pretty primitive, but looks like it's enough to spot the header tags easily enough. But what about modifying the HTML? It needs to print out everything it reads, with the same formatting.

    I also looked at HTML::TreeBuilder, and it can't output the same format that it read but produces its own re-generation of the text.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://270576]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found