If you really want this, I suggest you just use HTML::Parser (or HTML::TokeParser::Simple) and make it so (it should be trivial).
here is some code (untested, but should work flawlessly)
You'll probably wanna tweak it some, to get exactly the look you want (you probably wanna ignore reply/comment links , strip away lastnode_id ...)use HTML::TokeParser::Simple; use URI::URL; use LWP::Simple 'get'; my $base = 'http://perlmonks.com/index.pl?replies=1&node_id=218130&dis +playtype=print'; my $html = get $base; my $p = HTML::TokeParser::Simple->new(\$html); my $n = 0; my @n = (); while(defined(my $t = $p->get_token)){ if( $t->is_start_tag('a') ) { push @n, URI::URL->new($t->return_attr->{href},$base)->abs if $t->return_attr->{href}; print '<strong>', $p->get_trimmed_text('/a'), "</strong><sup>$n</sup>"; $n++; }elsif( $t->is_end_tag('body') ) { print '<hr><pre>'; printf "%02.2d. %s\n",$_,$n[$_] for 0..$#n; print '</pre>'; } else { print $t->as_is; } }
Enjoy ;)
|
MJD says you can't just make shit up and expect the computer to know what you mean, retardo! ** The Third rule of perl club is a statement of fact: pod is sexy. |
In reply to Re: Possible Improvements for Print View
by PodMaster
in thread Possible Improvements for Print View
by BrotherAde
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |