Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could /almost/ have this with newsbeauter and lynx, except that the RSS feed doesn't include points or comment number and lynx doesn't indent comments, so all comments appear at the same thread level which is somewhat confusing.


I use this in my elinks hooks.pl to indent hn comments.

    use strict;
    use warnings;
    
    use Encode;
    use Mojo::DOM;

    sub pre_format_html_hook {
        my $url = shift;
        my $html = Mojo::DOM->new(decode_utf8(shift));
    
        if ($url =~ 'news\.ycombinator\.com') {
            $html->find('img[src="s.gif"]')->each(sub { my $e = shift;
                                                        my $w = $e->attr('width');
                                                        my $ns = ' ' x ( $w / 10 );
                                                        $e->replace($ns); });
    }

    return $html;
}




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: