45 lines
1.7 KiB
Ruby
45 lines
1.7 KiB
Ruby
xml.instruct!
|
|
|
|
xml.rdf :RDF, 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
'xmlns' => "http://purl.org/rss/1.0/", 'xmlns:dc' => "http://purl.org/dc/elements/1.1/",
|
|
'xmlns:sy' => "http://purl.org/rss/1.0/modules/syndication/",
|
|
'xmlns:admin' => "http://webns.net/mvcb/", 'xmlns:cc' => "http://web.resource.org/cc/",
|
|
'xmlns:content' => "http://purl.org/rss/1.0/modules/content/",
|
|
'xmlns:georss' => "http://www.georss.org/georss" do
|
|
xml.channel 'rdf:about' => root_url do
|
|
xml.title "Agenda du Libre [ #{params[:region].present? && params[:region] != 'all' ? Region.find(params[:region]).name : t('.all_regions')} ]"
|
|
xml.description 'Agenda des événements autour du Logiciel Libre'
|
|
xml.link 'http://www.agendadulibre.org'
|
|
xml.dc :language, 'fr'
|
|
xml.dc :creator, 'AgendaDuLibre.org'
|
|
|
|
xml.items do
|
|
xml.rdf :Seq do
|
|
for event in @events
|
|
xml.rdf :li, 'rdf:resource' => event_url(event)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
for event in @events
|
|
xml.item 'rdf:about' => event_url(event) do
|
|
xml.title "#{event.city}: #{event.title}, le #{l event.start_time.to_date, format: :long}"
|
|
xml.link event_url event
|
|
xml.dc :identifier, "#{event.id}@agendadulibre.org"
|
|
xml.dc :date, event.start_time.iso8601
|
|
xml.georss :point, "#{event.related_city.latitude} #{event.related_city.longitude}" rescue nil
|
|
|
|
@event = event
|
|
content = render file: '/events/show.html', locals: { rss: true }
|
|
|
|
xml.description strip_tags content
|
|
xml.content(:encoded) {
|
|
xml.cdata! sanitize content,
|
|
tags: %w(p br table tr td ul ol li a strong b em i img),
|
|
attributes: %w(href src width height)
|
|
}
|
|
end
|
|
end
|
|
end
|