blob: be9c39e7262f342f1c0658b56fc69f1a4eebefcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
<id>tag:<%= request.host %>,2005:<%= request.fullpath.split(".")[0] %></id>
<link type="text/html" rel="alternate" href="<%= request.protocol + request.host_with_port %>"/>
<link type="application/atom+xml" rel="self" href="<%= request.url %>"/>
<title><%= @track_thing.params[:title_in_rss] %></title>
<% @xapian_object.results.each do |result| %>
<%
# Get the HTML content from the same partial template as website search does
content = ''
if result[:model].class.to_s == 'InfoRequestEvent'
content += render :partial => 'request/request_listing_via_event', :formats => ['html'], :locals => { :event => result[:model], :info_request => result[:model].info_request }
else
content = "<p><strong>Unknown search result type " + result[:model].class.to_s + "</strong></p>"
end
# Pull out the heading as separate item, from the partial template
content.match(/(<span class="head">\s+<a href="[^>]*">(.*)<\/a>\s+<\/span>)/)
heading = $1
heading_text = $2
content.sub!(heading, "")
%>
<entry>
<id>tag:<%= request.host %>,2005:<%= result[:model].class %>/<%= result[:model].id %></id>
<published><%= result[:model].created_at.xmlschema %></published>
<link type="text/html" rel="alternate" href="<%= polymorphic_url(result[:model]) %>"/>
<title type="html"><%= heading_text %></title>
<content type="html"><%= content %></content>
</entry>
<% end %>
</feed>
|