Changeset 39 in bookmarks


Ignore:
Timestamp:
05/27/13 15:54:30 (12 years ago)
Author:
peter
Message:
  • include bookmark tags as Atom categories for the entry
  • include bookmark ctime as the Atom published datetime for the entry
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkApp.pm

    r38 r39  
    236236    require XML::Atom::Entry; 
    237237    require XML::Atom::Link; 
     238    require XML::Atom::Category; 
    238239 
    239240    my $feed = XML::Atom::Feed->new; 
     
    257258        $entry->id($bookmark->bookmark_uri->canonical); 
    258259        $entry->title($bookmark->title); 
     260         
    259261        my $link = XML::Atom::Link->new; 
    260262        $link->href($bookmark->uri); 
    261263        $entry->add_link($link); 
     264         
    262265        $entry->summary('Tags: ' . join(', ', @{ $bookmark->tags })); 
     266 
     267        my $cdatetime = time2isoz $bookmark->ctime; 
    263268        my $mdatetime = time2isoz $bookmark->mtime; 
    264269        # make the timestamp W3C-correct 
    265         $mdatetime =~ s/ /T/; 
     270        s/ /T/ foreach ($cdatetime, $mdatetime); 
     271        $entry->published($cdatetime); 
    266272        $entry->updated($mdatetime); 
     273         
     274        for my $tag (@{ $bookmark->tags }) { 
     275            my $category = XML::Atom::Category->new; 
     276            $category->term($tag); 
     277            $entry->add_category($category); 
     278        } 
     279 
    267280        $feed->add_entry($entry); 
    268281    } 
Note: See TracChangeset for help on using the changeset viewer.