Building an RSS Templating System
The blog posts might have been slow lately, but that’s only because there’s been an accumulation of interesting projects piling up on my hard drive. Here’s a few things that are in the pipe (which I’m talking about to stop my procrastination and force me to release them):
- Sandbox Theme for Tumblr so that you can use Sandbox CSS themes on tumblr.com
- Tumblr Theme Templates to make it easier to develop themes for tumblr.com without having to upload your theme to tumblr.com
- Tumblr automatic backup + restore
- WordPress.com automatic backup
- Twitter There Will Be Followers – program to automatically follow back anyone who is following you on Twitter
- PostMaster html2blog – automatically post formatted HTML to Tumblr, Blogger or WordPress
- rss2html – powerful templating system for converting an RSS feed into HTML
It’s the last one I want to talk about. I’ve gotten tired of using Yahoo Pipes + Pipe Cleaner to build digest posts. It’s kind of a pain in the butt. So I want something that can take an rss feed, convert it to html so that I can use another program for automatically posting it to the blog. I’m not going the plugin route because of WordPress.com’s inability to support javascript or PHP plugins.
This is what I’ve come up with.
The idea is simple: give it an RSS feed and a template file and it will fill in parts of that template with data from RSS feed. The syntax looks like HTML with some Ruby code plugged in. I think it’ll be too hard to use for novices, but people who are comfortable with HTML and RSS should be able to use it without having to know how to program.
What can you use it for? Well, my weekly digest can be created using it. Any kind of ‘daily tweets’ type of post could be built using it. But those are just the easy stuff. It’s flexible enough that the sky is the limit. If you can do something with Yahoo Pipes, then you can do it with this program, except you’ll have fine grained control over the output.
Here’s an example.
Template
<% @rss.remove_items_tagged(['Best of Feeds', 'Monthly Digest']) %> <ul> <% @rss.items.each do |item| %> <li> <%= item.title_link %><br /> <%= item.description.no_html %><br /> </li> <% end %> <li><%= credit_link %></li> </ul>
HTML Output
- Searching for the Perfect Inline Code Documentation Tool
I have an intense love automatic documentation generation. Nothing makes me more tickled pink than seeing code and documentation living side by side in perfect harmony. I hate seeing documentation put on the company intranet only to diverge from the code it’s supposed to explain as the days go past. I hate hitting my head against a brick wall as I’m pouring through the source code trying to understand an API because at no point does it mention that it’s documented in a Word doc in another directory. This is my rule of programming: documentation should live beside the code it documents, in the comments, especially if it’s API documentation. - Mashing Your MP3 Music Collection with Last.FM
One geek itch I’ve been wanting to scratch is to be able to listen to my MP3 collection using the recommendations from Last.FM. I’ve you’ve never heard of Last.FM, it is a music service that lets you listen music as a radio station over the internet. I’ve been using it for a year and a half and I love it; it’s helped me discover so much good music. I’ve found two ways to automatically build MP3 playlists using online recommendations. The first way uses iTunes replacement Media Monkey and some extensions to connect to Last.FM (thanks TJOHO!) and the second way uses software by a new startup called The Filter (backed by Peter Gabriel). - How to Explain RSS to Normal People – 2008 Edition
As a geek who enjoys spending too much time on the internet, I like RSS almost as much as delicious toast. As a blogger, RSS is the shiznitz because it lets you consume a lot more information and it makes it easier for other people to read your blog without having to drop by every few days to see if you’ve written something new. For something so useful, it’s pretty hard to explain why people should use RSS. Lots of people try to do it. This is my take on it. It’s 2008 and explaining RSS should be much simpler because if you’ve used Facebook, then you’ve used RSS. - I Can Has Ruby?
I have a new tumblelog for ruby stuff. - How to delete your Tumblr tumblelog with TumblrCleanr
There’s one feature missing on Tumblr: how do you delete your Tumblr? At some point you might want to destroy all traces of your tumblr (privacy concerns, or you want to use it for something else) and there isn’t an option to do that — other than click the delete button on every individual post. I wanted to repurpose a tumblr I had been using for feed aggregation and it had over 18,000 posts. That’s a lot of clicks. Enter the TumblrCleanr. Provide it with your tumblr domain name as well as your username and password and it will delete up to the latest 3000 posts at a time. You can keep running it until your entire tumblr is clean as a whistle. - Book Review: Halting State by Charles Stross
If you’re a programmer/gamer geek and looking for a gripping book that you won’t be able to put down then look no further than Halting State. - Created with rss2html
But Wait, There’s More
Like I said, that was the trivial example. Here’s a list of all the operators I have so far:
Action on All RSS Items
- Remove Items
- @rss.remove_items_older_than(7.days.ago): remove items older than 7 days from the list
- @rss.remove_items_older_than(1.month.ago): remove items older than 1 month from the list
- @rss.remove_items_tagged(‘toread’): remove any items with the tag ‘toread’
- Ignore Tags
- @rss.ignore_tags(‘linkblog’): don’t display the tag ‘linkblog’
- @rss.ignore_tags([‘linkblog’,’toread’]): don’t display the tags ‘linkblog’ or ‘toread’
- Display Tags for All Items
- @rss.tags.to_s: Programming Tools, Ruby, Technology, Writing Better Documentation, automatic document generation tools, code, development, doxygen, perldoc, plain old documentation, pod, RDoc, Geeking Out, Music, MP3s and Internet Radio, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter, Building a Community, Facebook, Humor, RSS Syndication, rss, ruby, simple help, Asides, IDT Labs Software Development, Software, Tumblr, Web 2.0 Blogging, delete tumblr account, free software, microblogging
- @rss.tags.to_sentence: Programming Tools, Ruby, Technology, Writing Better Documentation, automatic document generation tools, code, development, doxygen, perldoc, plain old documentation, pod, RDoc, Geeking Out, Music, MP3s and Internet Radio, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter, Building a Community, Facebook, Humor, RSS Syndication, rss, ruby, simple help, Asides, IDT Labs Software Development, Software, Tumblr, Web 2.0 Blogging, delete tumblr account, free software, and microblogging
- @rss.tags.sort_by_least_frequent.to_sentence: Asides, Building a Community, Facebook, Geeking Out, Humor, IDT Labs Software Development, Music, MP3s and Internet Radio, Programming Tools, RDoc, RSS Syndication, Software, Tumblr, Web 2.0 Blogging, Writing Better Documentation, automatic document generation tools, code, delete tumblr account, development, doxygen, free software, ipod, itunes, last.fm, media monkey, media monkey and last.fm, microblogging, mp3, mp3 software, music, perldoc, plain old documentation, pod, rss, simple help, the filter, ruby, Ruby, and Technology
- @rss.tags.sort_by_most_frequent.to_sentence: Technology, Ruby, ruby, the filter, simple help, rss, pod, plain old documentation, perldoc, music, mp3 software, mp3, microblogging, media monkey and last.fm, media monkey, last.fm, itunes, ipod, free software, doxygen, development, delete tumblr account, code, automatic document generation tools, Writing Better Documentation, Web 2.0 Blogging, Tumblr, Software, RSS Syndication, RDoc, Programming Tools, Music, MP3s and Internet Radio, IDT Labs Software Development, Humor, Geeking Out, Facebook, Building a Community, and Asides
- @rss.tags.top(10): Technology, Ruby, ruby, the filter, simple help, rss, pod, plain old documentation, perldoc, music
- @rss.tags.bottom(10): Asides, Building a Community, Facebook, Geeking Out, Humor, IDT Labs Software Development, Music, MP3s and Internet Radio, Programming Tools, RDoc, RSS Syndication
- @rss.tags.top(10).to_technorati: Technology, Ruby, ruby, the filter, simple help, rss, pod, plain old documentation, perldoc, music
- @rss.tags[0..9].sort.to_technorati: Programming Tools, Ruby, Technology, Writing Better Documentation, automatic document generation tools, code, development, doxygen, perldoc, plain old documentation
- @rss.tags[0..9].sort.reverse.to_technorati: plain old documentation, perldoc, doxygen, development, code, automatic document generation tools, Writing Better Documentation, Technology, Ruby, Programming Tools
- @rss.tags[0..9].upcase.sort.to_technorati: AUTOMATIC DOCUMENT GENERATION TOOLS, CODE, DEVELOPMENT, DOXYGEN, PERLDOC, PLAIN OLD DOCUMENTATION, PROGRAMMING TOOLS, RUBY, TECHNOLOGY, WRITING BETTER DOCUMENTATION
- @rss.tags[0..9].downcase.to_technorati: automatic document generation tools, code, development, doxygen, perldoc, plain old documentation, programming tools, ruby, technology, writing better documentation
- @rss.tags[0..9].capitalize.sort.to_technorati: Automatic document generation tools, Code, Development, Doxygen, Perldoc, Plain old documentation, Programming tools, Ruby, Technology, Writing better documentation
With Individual RSS Items
- Title and Link
- item.title: Mashing Your MP3 Music Collection with Last.FM
- item.link: http://internetducttape.com/2008/03/05/mashing-your-mp3-music-collection-with-lastfm/
- item.link.to_link: http://internetducttape.com/2008/03/05/mashing-your-mp3-music-collection-with-lastfm/
- item.title_link: Mashing Your MP3 Music Collection with Last.FM
- item.domain: internetducttape.com
- item.domain.to_link(‘http://’): internetducttape.com
- item.via_link:
- Tags
- item.tags.to_sentence: Geeking Out, Music, MP3s and Internet Radio, Technology, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, and the filter
- item.tags.to_links(‘http://del.icio.us/engtech/tag/’): Geeking Out, Music, MP3s and Internet Radio, Technology, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter
- item.tags.to_blog_tag(‘http://internetducttape.com/’): Geeking Out, Music, MP3s and Internet Radio, Technology, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter
- item.tags.to_blog_category(‘http://internetducttape.com/’): Geeking Out, Music, MP3s and Internet Radio, Technology, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter
- item.tags.to_blog_search(‘http://internetducttape.com/’): Geeking Out, Music, MP3s and Internet Radio, Technology, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter
- item.tags.to_delicious: Geeking Out, Music, MP3s and Internet Radio, Technology, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter
- item.tags.to_technorati: Geeking Out, Music, MP3s and Internet Radio, Technology, last.fm, ipod, itunes, media monkey, media monkey and last.fm, mp3, mp3 software, music, the filter
- Dates:
- item.date: Wed, 05 Mar 2008 18:38:25 -0500
- item.datetime_long: March 05, 2008 18:38
- item.datetime_short: 05 Mar 18:38
- item.datetime_rfc822: Wed, 05 Mar 2008 18:38:25 -0500
- item.datetime_to_s: 2008-03-05 18:38:25
- item.date_long: March 5, 2008
- item.date_short: 5 Mar
- item.date_rfc822: 5 Mar 2008
- item.date_fmt(“%x”): 03/05/08
- item.date_fmt(“%Y/%M/%d”): 2008/38/05
- item.date_fmt(“%A, %B %d, %Y”): Wednesday, March 05, 2008
- Descriptions:
- item.description.no_html: One geek itch I’ve been wanting to scratch is to be able to listen to my MP3 collection using the recommendations from Last.FM. I’ve you’ve never heard of Last.FM, it is a music service that lets you listen music as a radio station over the internet. I’ve been using it for a year and a half and I love it; it’s helped me discover so much good music. I’ve found two ways to automatically build MP3 playlists using online recommendations. The first way uses iTunes replacement Media Monkey and some extensions to connect to Last.FM (thanks TJOHO!) and the second way uses software by a new startup called The Filter (backed by Peter Gabriel).
- item.description.simple_html: <p class=”idt-header” style=”text-align:center;”></p> <p>One geek itch I’ve been wanting to scratch is to be able to listen to my MP3 collection using the recommendations from Last.FM. I’ve you’ve never heard of Last.FM, it is a music service that lets you listen music as a radio station over the internet. I’ve been using it for a year and a half and I love it; it’s helped me discover so much good music. </p><p> I’ve found two ways to automatically build MP3 playlists using online recommendations. The first way uses iTunes replacement Media Monkey and some extensions to connect to Last.FM (thanks TJOHO!) and the second way uses software by a new startup called The Filter (backed by Peter Gabriel).</p>
- item.description: <p class=”idt-header” style=”text-align:center;”><img src=”https://engtech.files.wordpress.com/2008/03/music-mp3-itunes.jpg” alt=”MP3 Music” height=”125″ width=”500″ /></p> <p>One geek itch I’ve been wanting to scratch is to be able to listen to my MP3 collection using the recommendations from Last.FM. I’ve you’ve never heard of Last.FM, it is a music service that lets you listen music as a radio station over the internet. I’ve been using it for a year and a half and I love it; it’s helped me discover so much good music. </p><p> I’ve found two ways to automatically build MP3 playlists using online recommendations. The first way uses iTunes replacement Media Monkey and some extensions to connect to Last.FM (thanks TJOHO!) and the second way uses software by a new startup called The Filter (backed by Peter Gabriel).</p>
Advanced Users
Most people won’t need these, but they can be helpful for the advanced users.
- debug(@rss): will display all of the attributes for the @rss object
- h(string): will escape HTML code in the string.
- rss2html(‘http://internetducttape.com/feed’, ‘idt.rhtml’): will include another feed/template combo
But Would You Use It?
I’m trying to gage how interesting this is (or even if it’s too hard to use for the normal person). What would you like to use a program like this for? What other things would you like for it to be able to do?
4 Responses
Subscribe to comments with RSS.
Comments are closed.
I’d be interested to see what you can do with the FriendFeed Feed. I’d like to display only particular items from that feed.
I lean towards the simple uses. But I have found that the Pipe Cleaner doesn’t always kick in when I run the Tumblr pipe.
The backup WordPress.com would be very useful, especially if it gives me a means similar to Zoundry of a local copy of the blog that I can search or grab titles and links to make ToC or indices or referrals in new posts.
I don’t suppose you have anything cooking to be able to grab some of the backend WordPress.com stuff such as search terms? Their “stats” is getting better but this one aspect is still poor if trying to find out a month’s or annual search terms (all not just the most popular)
Cool :) I just co-wrote a small web app that provides similar functionality- it displays an RSS feed with customizable Tumblr-like themes: http://feedvolley.com/
[…] Building an RSS Templating System « // Internet Duct Tape. […]