Changeset 10

Show
Ignore:
Timestamp:
02/04/06 18:58:13
Author:
miyagawa
Message:

Simplified Widget API
Added Widget::HatenaBookmark? using icon

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger

    • Property svn:ignore set to config.yaml
  • trunk/plagger/lib/Plagger/Plugin/Widget/Delicious.pm

    r3 r10  
    22use strict; 
    33use base qw( Plagger::Plugin ); 
     4 
     5use Encode; 
     6use HTML::Entities; 
     7use URI; 
    48 
    59sub register { 
     
    1317sub add { 
    1418    my($self, $context, $entry, $content) = @_; 
    15     my $widget = Plagger::Widget::Delicious->new( 
    16         username => $self->conf->{username}, 
    17         entry => $entry, 
    18     ); 
    19     $entry->add_widget($widget); 
    20 
    21  
    22 package Plagger::Widget::Delicious; 
    23  
    24 use Encode; 
    25 use HTML::Entities; 
    26 use URI; 
    27  
    28 sub new { 
    29     my($class, %opt) = @_; 
    30     bless \%opt, $class; 
     19    $entry->add_widget($self); 
    3120} 
    3221 
    3322sub html { 
    34     my $self = shift
    35     my $uri = URI->new('http://del.icio.us/' . $self->{username}); 
     23    my($self, $entry) = @_
     24    my $uri = URI->new('http://del.icio.us/' . $self->conf->{username}); 
    3625    $uri->query_form( 
    3726        v => 3, 
    38         url => $self->{entry}->link, 
    39         title => encode('utf-8', $self->{entry}->title), 
     27        url => $entry->link, 
     28        title => encode('utf-8', $entry->title), 
    4029    ); 
    4130 
  • trunk/plagger/templates/plugins/gmail_notify.tt

    r7 r10  
    99[% IF item.body.match('(?i)^<p[ >]') %][% item.body %][% ELSE %]<div style="padding: 1em 0">[% item.body %]</div>[% END %] 
    1010[% ELSE %]<br />[% END %] 
    11 <div style="font-size:0.8em">[% IF item.date %]Posted on [% item.date.format('Mail') %][% END %] | <a href="[% link | html %]">permalink</a> | <a href="[% feed.link | html %]">[% feed.title | html %]</a>[% FOREACH widget = item.widgets %] | [% widget.html %][% END %]<br clear="all" /></div> 
     11<div style="font-size:0.8em">[% IF item.date %]Posted on [% item.date.format('Mail') %][% END %] | <a href="[% link | html %]">permalink</a> | <a href="[% feed.link | html %]">[% feed.title | html %]</a>[% FOREACH widget = item.widgets %] | [% widget.html(item) %][% END %]<br clear="all" /></div> 
    1212</div>