Inspired by a look at
XML::RSS::JavaScript by
Ed Summers, I decided to crank out an MT template to do the same thing.
Here are the short steps, more details (probably it's own page) to follow:
1) Create a new template file. I call mine "Javascript Syndication." Name the output file rss.js
2) Create a new MT plugin (I called mine mt-rss-javascript-encode.pl) in your MT plugins directory. The code should look like this:
package MT::Plugin::FormatForJavascript;
use MT::Template::Context;
MT::Template::Context->add_global_filter(js_encode => sub {
(my $s = shift) =~ s/'/\\\'/g;
return $s;
});
1;
That should just about do it. Then, to use it, give someone the following snippet of JS:
<script Language="JavaScript" src="rss.js" />
Here is an example:
Sorry. The embedded script in an entry was freaking out my RSS feeds. You can see the results in the "Recent Code Changes" section on the side of the screen.