Changeset 312

Show
Ignore:
Timestamp:
05/25/06 17:04:25 (6 years ago)
Author:
nick
Message:

Include the categories in the Feeds, in the appropriate places

Location:
wiki-toolkit/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Feed/Atom.pm

    r310 r312  
    154154       $title =~ s/>/>/g; 
    155155 
    156     # TODO: Store categories in the atom:category element (4.2.2) 
     156    # Pop the categories into atom:category elements (4.2.2) 
     157    # We can do this because the spec says: 
     158    #   "This specification assigns no meaning to the content (if any)  
     159    #    of this element." 
     160    # TODO: Decide if we should include the "all categories listing" url 
     161    #        as the scheme (URI) attribute? 
     162    my $category_atom; 
     163    if($node->{metadata}->{category}) { 
     164        foreach my $cat (@{ $node->{metadata}->{category} }) { 
     165            $category_atom .= "    <category term=\"$cat\" />\n"; 
     166        } 
     167    } 
     168 
    157169    # TODO: Find an Atom equivalent of ModWiki, so we can include more info 
    158170     
     
    165177    <updated>$item_timestamp</updated> 
    166178    <author><name>$author</name></author> 
     179$category_atom 
    167180  </entry> 
    168181}; 
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Feed/RSS.pm

    r309 r312  
    200200       $title =~ s/</&lt;/g; 
    201201       $title =~ s/>/&gt;/g; 
     202 
     203    # Pop the categories into dublin core subject elements 
     204    #  (http://dublincore.org/usage/terms/history/#subject-004) 
     205    # TODO: Decide if we should include the "all categories listing" url 
     206    #        as the scheme (URI) attribute? 
     207    my $category_rss; 
     208    if($node->{metadata}->{category}) { 
     209        foreach my $cat (@{ $node->{metadata}->{category} }) { 
     210            $category_rss .= "  <dc:subject>$cat</dc:subject>\n"; 
     211        } 
     212    } 
    202213     
    203214    push @items, qq{ 
     
    214225  <modwiki:history>$history_url</modwiki:history> 
    215226  <rdfs:seeAlso rdf:resource="$rdf_url" /> 
     227$category_rss 
    216228</item> 
    217229}; 
  • wiki-toolkit/trunk/t/296_feed_rss_recentchanges_add_test_data.t

    r308 r312  
    4545                         { username => "Kake", 
    4646                           comment  => "new node", 
     47               category => [ 'TestCategory1', 'Meta' ] 
    4748                         } 
    4849                       ); 
  • wiki-toolkit/trunk/t/297_feed_rss_recentchanges.t

    r306 r312  
    55 
    66use Test::More tests => 
    7   (3 + 17 * $Wiki::Toolkit::TestConfig::Utilities::num_stores); 
     7  (3 + 18 * $Wiki::Toolkit::TestConfig::Utilities::num_stores); 
    88 
    99use_ok( "Wiki::Toolkit::Feed::RSS" ); 
     
    6969      like( $feed, qr|<description>.*\[nou]</description>|, 
    7070            "username included in description" ); 
     71 
     72      like( $feed, qr|<dc:subject>TestCategory1</dc:subject>|, 
     73            "dublin core subject contains category" ); 
    7174 
    7275      # Check that interwiki things are passed through right. 
  • wiki-toolkit/trunk/t/301_feed_atom_add_test_data.t

    r310 r312  
    4545                         { username => "Kake", 
    4646                           comment  => "new node", 
     47               category => [ 'TestCategory1', 'Meta' ] 
    4748                         } 
    4849                       ); 
  • wiki-toolkit/trunk/t/302_feed_atom_recentchanges.t

    r255 r312  
    55 
    66use Test::More tests => 
    7   (3 + 11 * $Wiki::Toolkit::TestConfig::Utilities::num_stores); 
     7  (3 + 12 * $Wiki::Toolkit::TestConfig::Utilities::num_stores); 
    88 
    99use_ok( "Wiki::Toolkit::Feed::Atom" ); 
     
    6262            "username included in summary" ); 
    6363 
     64      # Check we also have some categories 
     65      like( $feed, qr|<category term="TestCategory1" />|, 
     66            "contains categories" ); 
     67 
    6468      # Test the 'items' parameter. 
    6569      $feed = $atom->recent_changes( items => 2 );