Skip to content

Commit

Permalink
update OPML patch to latest commit
Browse files Browse the repository at this point in the history
  • Loading branch information
prefork committed Feb 10, 2011
1 parent 656b9da commit 74bb6da
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
18 changes: 18 additions & 0 deletions lib/github_trends.rb
Expand Up @@ -50,3 +50,21 @@

builder :show
end

get "/languages/:language.opml" do
if !LANGUAGES.include?(params['language'])
return 404
end

@language = params['language']
@contexts = CONTEXTS

builder :language
end

get "/trends.opml" do
@languages = LANGUAGES
@contexts = CONTEXTS

builder :trends
end
5 changes: 4 additions & 1 deletion views/index.haml
Expand Up @@ -30,11 +30,14 @@
%a{:href => "explore/forever.xml", :class => 'feed'}
Forever's most popular

%h3 Languages
%h3
Languages
%a{:href => "/trends.opml", :class => 'feed'} [OPML]

- @languages.each do |language|
%h4
= language
%a{:href => "/languages/"+language+".opml", :class => 'feed'} [OPML]
%ul
- @contexts.each do |context|
%li
Expand Down
11 changes: 11 additions & 0 deletions views/language.builder
@@ -0,0 +1,11 @@
xml.instruct! :xml, :version => "1.0"
xml.opml :version => "1.0" do
xml.head do
xml.title "#{@language} - All Feeds"
end
xml.body do
@contexts.each do |context|
xml.outline :title => "#{@language} - #{context.gsub('_', ' ').capitalize}", :text => "#{@language} - #{context.gsub('_', ' ').capitalize}", :type => "rss", :version => "RSS", :xmlUrl => "http://github-trends.oscardelben.com/languages/#{@language}/#{context}.xml", :htmlUrl => "http://github-trends.oscardelben.com/"
end
end
end
13 changes: 13 additions & 0 deletions views/trends.builder
@@ -0,0 +1,13 @@
xml.instruct! :xml, :version => "1.0"
xml.opml :version => "1.0" do
xml.head do
xml.title "Github Trends"
end
xml.body do
@contexts.each do |context|
@languages.each do |language|
xml.outline :title => "#{language} - #{context.gsub('_', ' ').capitalize}", :text => "#{language} - #{context.gsub('_', ' ').capitalize}", :type => "rss", :version => "RSS", :xmlUrl => "http://github-trends.oscardelben.com/languages/#{language}/#{context}.xml", :htmlUrl => "http://github-trends.oscardelben.com/"
end
end
end
end

0 comments on commit 74bb6da

Please sign in to comment.