Hi,
I am using MediaWiki both for the "collective documentation" of in-house projects, and as a CMS for the publication of my personal site.
Recently, I needed to publish as a RSS feed both a list of "important" articles (manually maintained) and the table of content of some (if not all) articles.
There are quite few extensions listed in http://www.mediawiki.org/wiki/Category:Feed_generator_extensions. But none of them really does the trick. Mostly because the feed generator was required to be *non intrusive*. I.e., usage of any special tag in the wikitext was prohibited.
In addition, it would have been preferable to work at *article* (by opposite to querying the database).
For all there reasons (and well ... also for fun, I must admit;) ) I started to work on a custom feed generator. In fact, it is mostly a wrapper around an XSLT stylesheet that build a RSS feed from the /first/ list found in an article parsed as HTML.
This has the advantage of working both for "in text" lists and for TOCs, since those are generated as a list before the first heading. So they are likely to be the first list of an article.
Moreover, since we are using the convention of beginning each article by a short description (more or less like a Wikipedia article), that text was relatively easy to extract as the description of the feed.
Of course, this is not 100% bulletproof, but it works most of the time. And require only to add "?action=tofeed" at the end of the URL to retrieve the feed of that article (could easily be hidden thought url rewriting).
Now, I think it would be great to share that code with the community. So here I join the source of this extension and the stylesheet. And I would be glad if anyone could take time to review that code. And telling me if I'm doing the things "the right way". Any hint or advice would also been greatly appreciated ;)
Best regards, Sylvain.
PS/You could try it "live" on my site: http://www.chicoree.fr/w/Derniers_articles?action=tofeed http://www.chicoree.fr/w/Installer_JBoss_AS_5?action=tofeed Those articles are in French. But at least it should let you have the feeling how it works.