patch な記事たち

Abstract

LoveVector の、タグ patch に関係のある記事群です。

PlaggerLDR で無理やり icon を表示する patch

URI
http://okowa.org/vector/2006/05/20/patch-pldr-icon
Created
2006-05-20T20:39:53+09:00
Tags
Writebacks
「PlaggerLDR で無理やり icon を表示する patch」への Comments: 6 / 「PlaggerLDR で無理やり icon を表示する patch」への Trackbacks: 0

いまの PlaggerLDR は icon がつかなくて mixi とかが悲しいので。

Index: lib/Plagger/Plugin/Store/DBIC.pm
===================================================================
--- lib/Plagger/Plugin/Store/DBIC.pm    (revision 789)
+++ lib/Plagger/Plugin/Store/DBIC.pm    (working copy)
@@ -103,10 +103,15 @@
             link => $feed_entry->link,
         });

-        for my $attr (qw/title author summary date body rate/) {    # todo: icon
+        for my $attr (qw/title author summary date rate/) {    # todo: restruct
             $entry->$attr( $feed_entry->$attr )
                 if defined $feed_entry->$attr && (!$entry->$attr or $entry->$attr ne $feed_entry->$attr);
         }
+        if (defined $feed_entry->body) {
+            my $tt = $c->template;
+            $tt->process('dbic_notify.tt', { entry => $feed_entry }, \my $body) or $c->error($tt->error);
+            $entry->body($body) if !$entry->body or $entry->body ne $body;
+        }
         $entry->insert_or_update if $entry->is_changed;

         # meta

assets/plugins/Store-DBIC/dbic_notify.tt:

<div>
[% USE util = Plagger.Util -%]
[% IF entry.icon %]<div><img [% util.dumbnail(entry.icon, width=150, height=60) %] align="right" src="[% entry.icon.url | html %]" alt="" /></div>
[% END -%]
[% IF entry.body.match('(?i)^<p[ >]') %][% entry.body %][% ELSE %]<div style="padding: 1em 0">[% entry.body %]</div>[% END %]
</div>

スキーマを変えて PlaggerLDR 側でやるのが正攻法だと思うけど,面倒なのでとりあえずこれで。

良く考えたらこれ Filter:: 書くべきだったかな。まぁいいや。

Topic Path

  1. okowa.org
  2. LoveVector
  3. patch
Last-Modified
2010-07-31T07:10:27+09:00
Feeds
Recent Updates (RSS 1.0)
Powered by
XML::LibXSLT / format.xsl / Movable Type 3.31-ja
LoveVector : klm <klm at okowa dot org>