kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-11-13 01:43 am

[dw-free] Support for <dc:creator>

[commit: http://hg.dwscoalition.org/dw-free/rev/16f32224086c]

http://bugs.dwscoalition.org/show_bug.cgi?id=1690

Show contents of "dc:creator" element as post author in syndicated feeds.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/ParseFeed.pm
  • cgi-bin/LJ/SynSuck.pm
--------------------------------------------------------------------------------
diff -r 4af523013a87 -r 16f32224086c cgi-bin/LJ/ParseFeed.pm
--- a/cgi-bin/LJ/ParseFeed.pm	Thu Nov 12 12:41:30 2009 -0600
+++ b/cgi-bin/LJ/ParseFeed.pm	Thu Nov 12 19:43:32 2009 -0600
@@ -89,6 +89,7 @@ sub parse_feed
         $item->{'text'} = $_->{'description'};
         $item->{'link'} = $_->{'link'} if $_->{'link'};
         $item->{'id'} = $_->{'guid'} if $_->{'guid'};
+        $item->{author} = $_->{dc}->{creator} if $_->{dc} && $_->{dc}->{creator};
 
         my $nsdc = 'http://purl.org/dc/elements/1.1/';
         my $nsenc = 'http://purl.org/rss/1.0/modules/content/';
diff -r 4af523013a87 -r 16f32224086c cgi-bin/LJ/SynSuck.pm
--- a/cgi-bin/LJ/SynSuck.pm	Thu Nov 12 12:41:30 2009 -0600
+++ b/cgi-bin/LJ/SynSuck.pm	Thu Nov 12 19:43:32 2009 -0600
@@ -279,6 +279,11 @@ sub process_content {
         $it->{'text'} =~ s/^\s+//;
         $it->{'text'} =~ s/\s+$//;
 
+        my $author = "";
+        if ( defined $it->{author} ) {
+            $author = "<p class='syndicationauthor'>Posted by " . LJ::ehtml( $it->{author} ) . "</p>";
+        }
+
         my $htmllink;
         if (defined $it->{'link'}) {
             $htmllink = "<p class=\"ljsyndicationlink\">" .
@@ -329,7 +334,7 @@ sub process_content {
             'username' => $user,
             'ver' => 1,
             'subject' => $it->{'subject'},
-            'event' => "$htmllink$it->{'text'}",
+            'event' => "$author$htmllink$it->{'text'}",
             'year' => $year,
             'mon' => $mon,
             'day' => $day,
--------------------------------------------------------------------------------
jadelennox: a sign which reads "GIRLS GIRLS GIRLS GORGEOUS LIBRARIANS"  (liberrian: girls girls girls)

[personal profile] jadelennox 2009-11-19 07:23 pm (UTC)(link)
♥♥♥ Dublin core metadata support.