Simple Text to RSS



1   Overview
2   Usage
3   Browse the code
4   Get the code

1. Overview.

This page is intended for admins and developers.

I've written a Perl script named stexttorss that can be used to create and maintain small RSS feeds. Note: The name stexttorss is short for “Simple Text to RSS”. This page provides source code and instructions.

The script is convenient because it's easy to modify and extend. However, admins who are working with complex RSS feeds may wish to look into more advanced scripts or components such as the CPAN module XML:RSS.

2. Usage.

stexttorss takes a text file as input and produces an RSS-compatible XML file as output. Usage is as follows:

stexttorss  input.txt  >  output.xml

The text input file should contain one or more entries in the following format. Each entry consists of a separator line, a date-time line, a link to a webpage, and one or more lines of descriptive text. For example:

Jan 7, 2012 12:01pm
I like apples. This text can be
multiple lines.

January 6, 2012 3pm
Oranges are O.K. as well.

Entries should be listed from newest (at the start) to oldest (at the end). Presently, this program doesn't sort them.

Separator lines may use “equals” signs or dashes. The exact length of the separator lines doesn't matter, as long as they're more than a few characters long.

As shown above, the date-time line may abbreviate the month name and/or the time. Note: In the output file, times are represented as GMT values.

3. Browse the code.

To browse the source code, click here.

4. Get the code.

To download a ZIP file that contains the script, use this link.

There's one dependency other than Perl. The CPAN module Date::Parse must be installed before the script will work.

Before using the script to create an RSS feed for an actual website, edit the script and modify the definitions in the program parameters section appropriately.

Hosting provided by Zymic.

For acknowledgments related to CSS and other code used, click here.

Linked or embedded works (software, books, articles, etc.) are presented under their own licenses.

Other unique content on this page, excluding screenshots, is distributed under the following license: C.C. Attribution NonCommercial ShareAlike 3.0. In some cases, screenshots are distributed under the same license. In other cases, the associated program's license applies.

image Valid XHTML 1.0