Commits

Koen Van der Auwera committed 1d1c311

set description as CDATA

Comments (0)

Files changed (1)

 require "rss"
+require "rss/rss"
+
+module RSS
+  module BaseModel
+    def install_cdata_element(tag_name, uri, occurs, name=nil, type=nil, disp_name=nil)
+      name ||= tag_name
+      disp_name ||= name
+      self::ELEMENTS << name
+      add_need_initialize_variable(name)
+      install_model(tag_name, uri, occurs, name)
+
+      def_corresponded_attr_writer name, type, disp_name
+      convert_attr_reader name
+      install_element(name) do |n, elem_name|
+        <<-EOC
+        if @#{n}
+          rv = "\#{indent}<#{elem_name}>"
+          value = "<![CDATA[" + eval("@#{n}") + "]]>"
+          if need_convert
+            rv << convert(value)
+          else
+            rv << value
+          end
+          rv << "</#{elem_name}>"
+          rv
+        else
+          ''
+        end
+EOC
+      end
+    end
+  end
+
+  class Rss
+    class Channel
+      class Item
+        install_cdata_element "description", "", "?", "description"
+      end
+    end
+  end
+end
 
 module Amanda
   class Feed
         maker.channel.description = title
         posts.each do |post|
           maker.items.new_item do |item|
-            # item.guid ="#{url}/#{post.url}"
-            item.link = "#{url}/#{post.url}"
+            item.guid.content ="#{url.chomp("/")}#{post.url}"
+            item.link = "#{url.chomp("/")}#{post.url}"
             item.title = post.title
             item.updated = post.published_at
             item.description = post.html
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.