Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Possible Improvements for Print View

by BrotherAde (Pilgrim)
on Dec 06, 2002 at 18:07 UTC ( [id://218114]=monkdiscuss: print w/replies, xml ) Need Help??

Fellow Monks,

I have just printed a node with a couple of links in it. These links turn up, as usual, as blue, underlined text. I was thinking that there's room for improvement there, after all, you can't click on a piece of paper.

What I propose is, that in print view, the addresses of links are added to the end of the printed node as footnotes.

To give you an example:

...blah blah, as can be seen on this site, is really quite blah blah rhubarb...
would be printed as:
...blah blah, as can be seen on this site1 is really quite blah blah rhubarb...
.
.
.
End of article

Links:
  1. http://www.perlmonks.org

I think it's time I grabbed the source of Everthing and start looking around... Unless somebody has violently allergic reactions to my suggestion.

Let me know what you think

BrotherAde

Replies are listed 'Best First'.
Re: Possible Improvements for Print View
by PodMaster (Abbot) on Dec 06, 2002 at 20:11 UTC
    I'm not too convinced this change needs to be made, but anyway, a copy of Everything will not help you too much in this case.

    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)

    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; } }
    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 ...)

    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.

Re: Possible Improvements for Print View
by Chady (Priest) on Dec 07, 2002 at 08:59 UTC

    Not sure if this is such a good idea since no browser is fully CSS-2 compliant, but I read at Alist Apart about this print stylesheet:

    a:link:after, a:visited:after { content: " (" attr(href) ") "; }
    And then there's the CSS-3 selectors to fix the relative links:
    a[href^="/"]:after { content: " (http://www.perlmonks.org" attr(href) ") "; }
    But no browser seems to support these two yet so this suggestion goes directly down the drain...
    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady | http://chady.net/
Re: Possible Improvements for Print View
by John M. Dlugosz (Monsignor) on Dec 23, 2002 at 08:10 UTC
    Re: after all, you can't click on a piece of paper.

    Have you tried picking up the cursor off the screen and putting in on the paper? If you can't, you need a driver upgrade.


    Old joke, but a favorite one so I couldn't resist.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-19 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found