package links; use strict; my $CacheFile = "$blosxom::plugin_state_dir/links.cache"; my $TitleMax = 36; sub start { return 1; } sub story { my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_; $$body_ref =~ s!(.*?)!filter_html($1)!sge or return 0; return 1; } sub filter_html { require Unicode::String; require URI; require YAML; my $html = shift; my @lines = grep { defined && length } split /\r?\n/, $html; my $new_html = "\n"; $new_html; } sub get_title { my($cache, $url, $changed_ref) = @_; unless ($cache->{$url}) { warn "getting ", $url->as_string; require Jcode; require LWP::Simple; my $html = LWP::Simple::get($url); $html =~ m!\s*(.*?)\s*!si; my $title = $1 ? Jcode->new($1)->utf8 : $url->host; $cache->{$url} = $title; $$changed_ref++; } return $cache->{$url}; } 1;