|
@@ -3,12 +3,13 @@ require 'pp' |
|
|
require 'erb' |
|
|
require 'erb' |
|
|
require 'time' |
|
|
require 'time' |
|
|
|
|
|
|
|
|
|
|
|
# https://gist.github.com/adrianshort/5547284 |
|
|
# $ ruby csv2georss.rb myfile.csv > feed.xml |
|
|
# $ ruby csv2georss.rb myfile.csv > feed.xml |
|
|
|
|
|
|
|
|
template = ERB.new <<-EOF |
|
|
template = ERB.new <<-EOF |
|
|
<?xml version="1.0" encoding="UTF-8" ?> |
|
|
<?xml version="1.0" encoding="UTF-8" ?> |
|
|
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> |
|
|
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> |
|
|
<channel> |
|
|
|
|
|
|
|
|
<channel> |
|
|
<title><%= channel[:title] %></title> |
|
|
<title><%= channel[:title] %></title> |
|
|
<link><%= channel[:link] %></link> |
|
|
<link><%= channel[:link] %></link> |
|
|
<description><%= channel[:description] %></description> |
|
|
<description><%= channel[:description] %></description> |
|
@@ -30,9 +31,9 @@ template = ERB.new <<-EOF |
|
|
EOF |
|
|
EOF |
|
|
|
|
|
|
|
|
channel = { |
|
|
channel = { |
|
|
:title => "Open Plaques", |
|
|
|
|
|
:link => "http://openplaques.org/", |
|
|
|
|
|
:description => "Documenting the historical links between people and places, as recorded by commemorative plaques." |
|
|
|
|
|
|
|
|
:title => "Plaque Guide", |
|
|
|
|
|
:link => "http://www.plaqueguide.com/", |
|
|
|
|
|
:description => "" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
items = [] |
|
|
items = [] |
|
@@ -50,7 +51,7 @@ CSV.foreach(ARGV[0]) do |row| |
|
|
:link => link, |
|
|
:link => link, |
|
|
:description => row[32], # note1 |
|
|
:description => row[32], # note1 |
|
|
:pubDate => Time.now.rfc822, |
|
|
:pubDate => Time.now.rfc822, |
|
|
:author => "feedback@openplaques.org", |
|
|
|
|
|
|
|
|
:author => "info@plaqueguide.com", |
|
|
:guid => link, |
|
|
:guid => link, |
|
|
:lat => row[5], |
|
|
:lat => row[5], |
|
|
:long => row[6] |
|
|
:long => row[6] |
|
|