User:Jdz~mediawikiwiki

From mediawiki.org

Me[edit]

http://embeddedlinuxguy.github.com

I am interested in generating RSS feeds (and other forms of activity streams, such as tweets) based on Wikipedia content.

I am also interested in a UI which allows the user to select from a list of pages based on page "rank": relevance, quality, recommendations, etc.

I run MediaWiki 1.15.2 at http://hardware.modernhacker.com/mediawiki (needs work)

http://twitter.com/modernhacker

Parser[edit]

We wish to incorporate user-written parsers for parsing individual wiki pages and generating messages. Every user-written parser contains 3 stanzas: the template of the page we wish to parse, the grammar which defines the elements in that page, and a snippet of transformational code which generates the output message.

STANZA I. TEMPLATE.

The general layout of our structured data, and name tokens which will be placeholders for specific data items.

Example:

== Upcoming Events .* ==
* Time1 Date1 Event1
== Recurring Events .* ==
* Day1
** Time1 [Link1] Event1

STANZA II. GRAMMAR

Here we define the tokens which appear in the template, which may be string literals or regular expressions. We use some BNF to generate the grammar.

Example:

Upcoming Events -> "Upcoming Events" # literal
DayN -> Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
TimeN -> nn:nn, '''nn:nn''', nn:nn-nn:nn


STANZA III. TRANSFORMATION.

Here we provide a function to generate the message based on the token values. This is "plugin" code which might be in PHP, Perl, Python, etc. We can provide plugin writers with an API to get the date and time, fetch URLs, and use persistant storage. There may be multiple transformational stanzas to address different backends (Twitter, RSS, etc).


Example:

$shortday = substr($TODAY, 0, 3);
$output = $shortday . " ";
for (1..$N) {
  $output .= $Link[$N] . " ";
}
return $output;