<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>bbPress plugin browser Topic: MediaWiki wikitext Filter</title>
<link>http://bbpress.org/plugins/</link>
<description>bbPress plugin browser Topic: MediaWiki wikitext Filter</description>
<language>en</language>
<pubDate>Tue, 02 Dec 2008 16:49:28 +0000</pubDate>

<item>
<title>dmitriid on "MediaWiki wikitext Filter"</title>
<link>http://bbpress.org/plugins/topic/mediawiki-wikitext-filter/#post-230</link>
<pubDate>Wed, 09 May 2007 11:57:10 +0000</pubDate>
<dc:creator>dmitriid</dc:creator>
<guid isPermaLink="false">230@http://bbpress.org/plugins/</guid>
<description>&#60;p&#62;There are numerous errors in this code. &#60;/p&#62;
&#60;ul&#62;
&#60;li&#62;patterns should be enclosed in //:
&#60;ul&#62;
&#60;li&#62;incorrect: &#124;pattern&#124;&#60;/li&#62;
&#60;li&#62;correct: /pattern/&#60;/li&#62;
&#60;/ul&#62;
&#60;/li&#62;
&#60;li&#62;all special characters must be escaped with \:
&#60;ul&#62;
&#60;li&#62;incorrrect:&#60;code&#62;/([[)(.*?)&#124;(.*?)(]])/&#60;/code&#62;&#60;/li&#62;
&#60;li&#62;corrrect:&#60;code&#62;/(\[\[)(.*?)\&#124;(.*?)(\]\])/&#60;/code&#62;&#60;/li&#62;
&#60;/ul&#62;
&#60;/li&#62;
&#60;li&#62;backreferences are referenced with $n, where n is a number:
&#60;ul&#62;
&#60;li&#62;incorrrect:&#60;code&#62;&#38;lt;strong&#38;gt;&#38;lt;em&#38;gt;2&#38;lt;/em&#38;gt;&#38;lt;/strong&#38;gt;&#60;/code&#62;&#60;/li&#62;
&#60;li&#62;corrrect:&#60;code&#62;&#38;lt;strong&#38;gt;&#38;lt;em&#38;gt;$2&#38;lt;/em&#38;gt;&#38;lt;/strong&#38;gt;&#60;/code&#62;&#60;/li&#62;
&#60;/ul&#62;
&#60;/li&#62;
&#60;/ul&#62;
&#60;p&#62;Here's the updated working version:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
/*
Plugin Name: MediaWiki Markup for bbPress
Plugin URI: &#60;a href=&#34;http://bbpress.org/forums/topic/713&#34; rel=&#34;nofollow&#34;&#62;http://bbpress.org/forums/topic/713&#60;/a&#62;
Description: Add a subset of MediaWiki markups to bbPress
Version: 0.1
Author: Jason Godesky
Author URI: &#60;a href=&#34;http://anthropik.com/&#34; rel=&#34;nofollow&#34;&#62;http://anthropik.com/&#60;/a&#62;
*/

/*  Copyright 2006  Jason Godesky  (email : &#60;a href=&#34;mailto:jason@anthropik.com)&#34;&#62;jason@anthropik.com)&#60;/a&#62;

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/*
These parameters specify the functioning of this plugin.
Edit accordingly for your specific situation.
*/

# Wiki root; &#38;quot;internal&#38;quot; links will point to the concatenation
# of this root and the link specified.
$mediawiki_filter_params[&#38;quot;wiki&#38;quot;] = &#38;quot;http://en.wikipedia.org/wiki&#38;quot;;

/*
Stop editing; actual plugin functionality follows.
*/

function bb_mediawikitext($text) {
    global $mediawiki_filter_params;
    // BASIC FORMATTING
    // Bold and italic
    $text = preg_replace(&#38;quot;/(\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;)(.*?)(\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;)/&#38;quot;,
        &#38;quot;&#38;lt;strong&#38;gt;&#38;lt;em&#38;gt;$2&#38;lt;/em&#38;gt;&#38;lt;/strong&#38;gt;&#38;quot;, $text);

    // Bold
    $text = preg_replace(&#38;quot;/(\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;)(.*?)(\\\&#38;#39;\\\&#38;#39;\\\&#38;#39;)/&#38;quot;,
        &#38;quot;&#38;lt;strong&#38;gt;$2&#38;lt;/strong&#38;gt;&#38;quot;, $text);
    // Italic
    $text = preg_replace(&#38;quot;/(\\\&#38;#39;\\\&#38;#39;)(.*?)(\\\&#38;#39;\\\&#38;#39;)/&#38;quot;,
        &#38;quot;&#38;lt;em&#38;gt;$2&#38;lt;/em&#38;gt;&#38;quot;, $text);

    // LINKS
    // Internal links with aliases
    $text = preg_replace(&#38;quot;/(\\[\\[)(.*?)\\&#124;(.*?)(\\]\\])/&#38;quot;,
        &#38;quot;&#38;lt;a href=&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.$mediawiki_filter_params[&#38;quot;wiki&#38;quot;].&#38;quot;$2&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.&#38;quot;&#38;gt;$3&#38;lt;/a&#38;gt;&#38;quot;,
        $text);
    // Internal links without aliases
    $text = preg_replace(&#38;quot;/(\\[\\[)(.*?)(\\]\\])/&#38;quot;,
        &#38;quot;&#38;lt;a href=&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.$mediawiki_filter_params[&#38;quot;wiki&#38;quot;].&#38;quot;$2&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.&#38;quot;&#38;gt;$2&#38;lt;/a&#38;gt;&#38;quot;,
        $text);
    // External links with descriptions
    $text = preg_replace(&#38;quot;/(\\[)(.*?) (.*?)(\\])/&#38;quot;,
        &#38;quot;&#38;lt;a href=&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.&#38;quot;$2&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.&#38;quot;&#38;gt;$3&#38;lt;/a&#38;gt;&#38;quot;, $text);
    // External links with no description
    $count   = 1;
    $replace = TRUE;
    while ($replace) {
        $before = $text;
        $text = preg_replace(&#38;quot;/(\\[)(.*?)(\\])/&#38;quot;,
            &#38;quot;&#38;lt;a href=&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.&#38;quot;$2&#38;quot;.&#38;#39;&#38;quot;&#38;#39;.&#38;quot;&#38;gt;[&#38;quot;.$count.&#38;quot;]&#38;lt;/a&#38;gt;&#38;quot;,
            $text, 1);
        if ($before==$text) { $replace = FALSE; }
        $count++;
    }

    // HEADINGS
    $text = preg_replace(&#38;quot;/(======)(.*?)(======)/&#38;quot;,
        &#38;quot;&#38;lt;h6&#38;gt;$2&#38;lt;/h6&#38;gt;&#38;quot;, $text);
    $text = preg_replace(&#38;quot;/(=====)(.*?)(=====)/&#38;quot;,
        &#38;quot;&#38;lt;h5&#38;gt;$2&#38;lt;/h5&#38;gt;&#38;quot;, $text);
    $text = preg_replace(&#38;quot;/(====)(.*?)(====)/&#38;quot;,
        &#38;quot;&#38;lt;h4&#38;gt;$2&#38;lt;/h4&#38;gt;&#38;quot;, $text);
    $text = preg_replace(&#38;quot;/(===)(.*?)(===)/&#38;quot;,
        &#38;quot;&#38;lt;h3&#38;gt;$2&#38;lt;/h3&#38;gt;&#38;quot;, $text);
    $text = preg_replace(&#38;quot;/(==)(.*?)(==)/&#38;quot;,
        &#38;quot;&#38;lt;h2&#38;gt;$2&#38;lt;/h2&#38;gt;&#38;quot;, $text);

    // RETURN
    return $text;
}

add_filter(&#38;#39;pre_post&#38;#39;, &#38;#39;bb_mediawikitext&#38;#39;, 1);

?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>jefgodesky on "MediaWiki wikitext Filter"</title>
<link>http://bbpress.org/plugins/topic/mediawiki-wikitext-filter/#post-86</link>
<pubDate>Mon, 12 Feb 2007 21:08:03 +0000</pubDate>
<dc:creator>jefgodesky</dc:creator>
<guid isPermaLink="false">86@http://bbpress.org/plugins/</guid>
<description>&#60;p&#62;Filters posts and applies basic wikitext markup from MediaWiki&#60;/p&#62;
&#60;p&#62;&#38;lt;!--plugin-data-installation--&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;Add &#60;code&#62;mediawiki-wikitext-filter.php&#60;/code&#62; to your &#60;code&#62;/my-plugins/&#60;/code&#62; directory.&#38;lt;/p&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;!--plugin-data-faq--&#38;gt;&#60;br /&#62;
&#38;lt;h4&#38;gt;What markup is available?&#38;lt;/h4&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;p&#38;gt;The color of the stars is set in the &#60;code&#62;bb-ratings.css&#60;/code&#62; stylesheet file.  The yellow color comes from &#34;&#60;code&#62;background-color: #fc0;&#60;/code&#62;&#34;,&#60;br /&#62;
and the red color comes from &#34;&#60;code&#62;background-color: #d00;&#60;/code&#62;&#34;.  You can adjust these values to your taste.&#38;lt;/p&#38;gt;&#60;/p&#62;
&#60;ol&#62;
&#60;li&#62;Basic formatting: Bolding and Italicizing&#60;/li&#62;
&#60;li&#62;Basic internal links.  Aliases work, but this does not include template transclusion, image embedding, or anything fancy like that.&#60;/li&#62;
&#60;li&#62;External links.  External links without descriptions are numbered, and descriptions are displayed.&#60;/li&#62;
&#60;/ol&#62;
&#60;p&#62;&#38;lt;h4&#38;gt;Does it support lists?  Tables of contents?&#38;lt;/h4&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;p&#38;gt;No, but it would really be great if it did, so by all means give it a go.  That's the glory of open source, right?&#38;lt;/p&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;!--plugin-data-other_notes--&#38;gt;&#60;br /&#62;
&#38;lt;h3&#38;gt;Configuration&#38;lt;/h3&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;At present, there is only one configuration option to change, on line 35: $mediawiki&#60;em&#62;filter&#60;/em&#62;params[&#34;wiki&#34;].  This establishes the wiki you wish to use for &#34;internal&#34; links.  &#34;Internal&#34; links work by concatenating the link onto the end of this parameter.  The default value, &#34;http://en.wikipedia.org/wiki/&#34;, will point to the English Wikipedia.&#38;lt;/p&#38;gt;
&#60;/p&#62;</description>
</item>

</channel>
</rss>
