Commits

Chad Perrin committed f88879f

commented rss.html

--
user: Chad Perrin <code@apotheon.net>
branch 'default'
changed rss.rhtml

  • Participants
  • Parent commits 02548c6

Comments (0)

Files changed (1)

 <%
-path = File.dirname(__FILE__)
-$:.unshift path + '/lib'
-require 'bluecloth'
-require 'time'
-require 'yaml'
+  # Almost this entire file desperately needs to be eliminated in favor of methods in the lump library.
+  # Copyright 2011 Chad Perrin; distributed under the terms of the Open Works License (OWL)
+  # http://owl.apotheon.org
 
-channel_description = String.new(
-  "Blogstrapping is Chad Perrin's development blog, focusing on Lump development, software design, and the philosophy of programming."
-)
+  path = File.dirname(__FILE__)
+  $:.unshift path + '/lib'
+  require 'bluecloth'
+  require 'time'
+  require 'yaml'
 
-channel_date = Time.now.gmtime.rfc2822.sub('-', '+')
+  # This should be configurable.
+  channel_description = String.new(
+    "Blogstrapping is Chad Perrin's development blog, focusing on Lump development, software design, and the philosophy of programming."
+  )
 
-puts '<?xml version="1.0" encoding="iso-8859-1"?>'
-puts '<rss version="2.0">'
-puts '<channel>'
-puts
+  # This is the offending line for misreporting update times in RSS feeds.
+  # The problem could probably be solved by using the most recent ordinal date for content files.
+  channel_date = Time.now.gmtime.rfc2822.sub('-', '+')
 
+  puts '<?xml version="1.0" encoding="iso-8859-1"?>'
+  puts '<rss version="2.0">'
+  puts '<channel>'
+  puts
 
-puts '  <title>blogstrapping</title>'
-puts '  <link>http://blogstrapping.com</link>'
-puts "  <description>#{channel_description}</description>"
-puts "  <lastBuildDate>#{channel_date}</lastBuildDate>"
-puts "  <language>en-us</language>"
-puts
 
+  puts '  <title>blogstrapping</title>'
+  puts '  <link>http://blogstrapping.com</link>'
+  puts "  <description>#{channel_description}</description>"
+  puts "  <lastBuildDate>#{channel_date}</lastBuildDate>"
+  puts "  <language>en-us</language>"
+  puts
 
-config = YAML.load_file(path + '/lump.conf')
-content_path = "#{path}/#{config['body']['content_dir'].to_s}"
 
-content_listing = Dir.entries(content_path).select do |f|
-  f.match /.*\.txt$/
-end
+  config = YAML.load_file(path + '/lump.conf')
+  content_path = "#{path}/#{config['body']['content_dir'].to_s}"
 
-content_listing.sort.reverse.each do |entry_page|
-  entry_id = entry_page.sub('.txt', '')
-
-  entry_date = Time.gm( entry_id ).gmtime.rfc2822.sub('-','+')
-
-  entry_description = BlueCloth.new(
-    File.open("#{content_path}/#{entry_page}").read
-  ).to_html
-
-  puts '  <item>'
-  print '    <title>'
-
-  File.open("#{content_path}/#{entry_page}", 'r') do |c|
-    print c.readline.sub(/^#+\s+/, '').chomp
+  content_listing = Dir.entries(content_path).select do |f|
+    f.match /.*\.txt$/
   end
 
-  puts '</title>'
-  puts "    <link>http://blogstrapping.com/?page=#{entry_id}</link>"
-  puts "    <guid>http://blogstrapping.com/?page=#{entry_id}</guid>"
-  puts "    <pubDate>#{entry_date}</pubDate>"
-  puts "    <description>#{entry_description}</description>"
-  puts '  </item>'
-  puts
-end
+  content_listing.sort.reverse.each do |entry_page|
+    entry_id = entry_page.sub('.txt', '')
 
+    entry_date = Time.gm( entry_id ).gmtime.rfc2822.sub('-','+')
 
-puts '</channel>'
-print '</rss>'%>
+    entry_description = BlueCloth.new(
+      File.open("#{content_path}/#{entry_page}").read
+    ).to_html
+
+    puts '  <item>'
+    print '    <title>'
+
+    File.open("#{content_path}/#{entry_page}", 'r') do |c|
+      print c.readline.sub(/^#+\s+/, '').chomp
+    end
+
+    puts '</title>'
+    puts "    <link>http://blogstrapping.com/?page=#{entry_id}</link>"
+    puts "    <guid>http://blogstrapping.com/?page=#{entry_id}</guid>"
+    puts "    <pubDate>#{entry_date}</pubDate>"
+    puts "    <description>#{entry_description}</description>"
+    puts '  </item>'
+    puts
+  end
+
+
+  puts '</channel>'
+  print '</rss>'%>