Index: /trunk/BookmarkApp.pm
===================================================================
--- /trunk/BookmarkApp.pm	(revision 37)
+++ /trunk/BookmarkApp.pm	(revision 38)
@@ -10,5 +10,4 @@
 use JSON;
 use Bookmarks;
-
 use URI;
 
@@ -44,4 +43,57 @@
 sub _bookmarks { $_[0]->param('bookmarks') }
 
+sub _get_list_links {
+    my $self = shift;
+    my ($self_type, $tags) = @_;
+    my @links = (
+        {
+            text => 'HTML',
+            type => 'text/html',
+            query => {
+                tag => $tags,
+            },
+        },
+        {
+            text => 'JSON',
+            type => 'application/json',
+            query => {
+                tag => $tags,
+                format => 'json',
+            },
+        },
+        {
+            text => 'XBEL',
+            type => 'application/xml',
+            query => {
+                tag => $tags,
+                format => 'xbel',
+            },
+        },
+        {
+            text => 'Atom',
+            type => 'application/atom+xml',
+            path => 'feed',
+            query => {
+                tag => $tags,
+            },
+        },
+        {
+            text => 'URI List',
+            type => 'text/uri-list',
+            query => {
+                tag => $tags,
+            },
+        }
+    );
+
+    for my $link (@links) {
+        $link->{rel}  = $link->{type} eq $self_type ? 'self' : 'alternate';
+        $link->{href} = URI->new_abs($link->{path} || '', $self->param('base_uri'));
+        $link->{href}->query_form($link->{query});
+    }
+
+    return @links;
+}
+
 sub list {
     my $self = shift;
@@ -155,46 +207,4 @@
         $base_url .= '/' if $base_url =~ m{/bookmarks$};
 
-        my @links = (
-            {
-                text => 'Link',
-                type => 'text/html',
-                rel  => 'self',
-                query => {
-                    tag => \@tags,
-                },
-            },
-            {
-                text => 'JSON',
-                type => 'application/json',
-                rel  => 'alternate',
-                query => {
-                    tag => \@tags,
-                    format => 'json',
-                },
-            },
-            {
-                text => 'XBEL',
-                type => 'application/xml',
-                rel  => 'alternate',
-                query => {
-                    tag => \@tags,
-                    format => 'xbel',
-                },
-            },
-            {
-                text => 'Atom',
-                type => 'application/atom+xml',
-                rel  => 'alternate',
-                path => 'feed',
-                query => {
-                    tag => \@tags,
-                },
-            },
-        );
-        for my $link (@links) {
-            $link->{href} = URI->new_abs($link->{path} || '', $self->param('base_uri'));
-            $link->{href}->query_form($link->{query});
-        }
-
         return $self->tt_process(
             'list.tt',
@@ -204,5 +214,5 @@
                 selected_tag => $tags[0],
                 search_tags  => \@tags,
-                links        => \@links,
+                links        => [ $self->_get_list_links('text/html', \@tags) ],
                 all_tags     => \@all_tags,
                 cotags       => \@cotags,
@@ -234,17 +244,11 @@
     $feed->id($feed_uri->canonical);
 
-    my $self_link = XML::Atom::Link->new;
-    $self_link->type('application/atom+xml');
-    $self_link->rel('self');
-    $self_link->href($feed_uri->canonical);
-    $feed->add_link($self_link);
-
-    my $html_link = XML::Atom::Link->new;
-    $html_link->type('text/html');
-    $html_link->rel('alternate');
-    my $html_uri = $self->param('base_uri')->clone;
-    $html_uri->query_form(tag => \@tags);
-    $html_link->href($html_uri->canonical);
-    $feed->add_link($html_link);
+    for my $link ($self->_get_list_links('application/atom+xml', \@tags)) {
+        my $atom_link = XML::Atom::Link->new;
+        $atom_link->type($link->{type});
+        $atom_link->rel($link->{rel});
+        $atom_link->href($link->{href}->canonical);
+        $feed->add_link($atom_link);
+    }
 
     # construct a feed from the most recent 12 bookmarks
