-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfeed.atom.builder
More file actions
43 lines (38 loc) · 1.36 KB
/
feed.atom.builder
File metadata and controls
43 lines (38 loc) · 1.36 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
def get_all_authors(pub)
authors = []
pub.asset.creators.each do |author|
authors << author.person.name
end
pub.non_seek_authors.each do |author|
authors << author.last_name + " " + author.first_name
end
authors
end
atom_feed :language => "en-GB", :root_url => "/publications",
:id => "urn:methodbox:publication:feed",
'xmlns:openSearch' => 'http://a9.com/-/spec/opensearch/1.1/' do |feed|
feed.title "MethodBox Publications"
feed.updated !@publications.first.nil? ? @publications.first.created_at : Time.now
feed.tag! "openSearch:totalResults", @publications.length
@publications.each do |item|
published = !item.published_date.nil? ? item.published_date : Time.now
feed.entry item, :id => "urn:methodbox:publication:#{item.id}",
:published => published do |entry|
entry.title item.title
entry.summary truncate(white_list(item.abstract), :length=>200)
get_all_authors(item).each do |creator|
entry.author do |author|
author.name h(creator)
end
end
unless item.pubmed_id.nil?
entry.content "type" => "text/html",
"src" => "http://www.ncbi.nlm.nih.gov/pubmed/#{item.pubmed_id}"
end
unless item.doi.nil?
entry.content "type" => "text/html",
"src" => "https://doi.org/#{item.doi}"
end
end
end
end