From 9614bfef37e5fcc7f048150480b767f1afbac1a5 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Tue, 26 Jan 2016 11:57:04 +0100 Subject: more fix rss feed --- src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy | 6 ++++-- src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/groovy/org/xapek') diff --git a/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy b/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy index 7d72fbe..623c786 100644 --- a/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy +++ b/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy @@ -7,16 +7,18 @@ import org.xapek.yvesf.classifieds.Model.ClassifiedsList class Dumper { static dump(ClassifiedsList classifiedList, PrintWriter writer) { - new MarkupBuilder(writer).rss(version: '2.0') { + new MarkupBuilder(writer).rss(version: '2.0', 'xmlns:atom': 'http://www.w3.org/2005/Atom') { channel { title('Glocals') description('glocal classifieds feed') + link('https://www.xapek.org/git/yvesf/classifieds') classifiedList.each { Classified classified -> item { title("${classified.type} - ${classified.title} - ${classified.composedLocation}") guid(classified.link) link(classified.link) - author("${classified.mem_name}@noemail.local") + pubDate(classified.formattedDate) + author("${classified.mem_id}@noemail.local (${classified.mem_name})") description(getDescription(classified) + classified.description) } } diff --git a/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy b/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy index 35aafdf..b0c9e00 100644 --- a/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy +++ b/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy @@ -45,7 +45,9 @@ class Model { String title String id String mem_name + String mem_id String description + String date Classified(Map map) { metaClass.properties.each { MetaProperty property -> @@ -60,6 +62,9 @@ class Model { } } + String getFormattedDate() { + return Date.parse('MMM dd, yy', date).format('EEE, dd MMM yyyy HH:mm:ss Z') + } String getLink() { return "http://www.glocals.com/classifieds/housing-and-real-estate/${id}.htm" } -- cgit v1.2.1