wiki:MediaWikiPluginMacro

Version 8 (modified by rjollos, 4 years ago) (diff)

Added pageoutline.

MediaWiki language processor

Description

Plugin introduces new wiki macro `mediawiki'. Macro turns trac wiki into pure mediawiki. It is based on this script.

Bugs/Feature Requests

Existing bugs and feature requests for MediaWikiPluginMacro are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Installation

unzip mediawikipluginmacro.zip
cd mediawikipluginmacro

### next step (patch) only for python 2.3
python --version
patch -p0 <<EOP
diff -ruNb mediawiki.orig/parser.py mediawiki/parser.py
--- mediawiki.orig/parser.py	2007-07-13 15:17:50.000000000 +0200
+++ mediawiki/parser.py	2008-04-25 11:00:59.000000000 +0200
@@ -5,7 +5,7 @@
 """
 
 import re, random, math, locale
-from base64 import b64encode, b64decode
+from base64 import decodestring
 from trac.core import *
 from trac.wiki.api import IWikiMacroProvider
 
@@ -920,7 +920,10 @@
 
 def slugify(text):
         """docstring for slugify"""
-        return u'/'.join(slugifyBit(t) for t in text.split(u'/'))
+        temp = []
+        for t in text.split( u'/' ):
+            temp.append( slugifyBit( t ) )
+        return u'/'.join( temp )
 
 _linkPat = re.compile(ur'^([A-Za-z0-9\s]+:)?([A-Za-z0-9_\.\-\s\/]+)(?:\|([^\n]+?))?\]\](.*)$', re.UNICODE | re.DOTALL)
 def replaceInternalLinks(text):
@@ -1329,8 +1332,8 @@
                 m = _templateSectionPat.search(headline)
                 if m:
                         istemplate = True
-                        templatetitle = b64decode(m[0])
-                        templatesection = 1 + int(b64decode(m[1]))
+                        templatetitle = decodestring(m[0])
+                        templatesection = 1 + int(decodestring(m[1]))
                         headline = _templateSectionPat.sub(u'', headline)
                 
                 if toclevel:
EOP

python setup.py install

Source

You can check out MediaWikiPluginMacro from here using Subversion, or browse the source with Trac.

Example

{{{
#!mediawiki
= Heading =
Everything here is interpreted by ''mediawiki'' processor.

== List ==
# first
## first.a
## first.b

[Wiki link]
}}}

Recent Changes

[2483] by permon on 2007-07-18 13:53:41
MediaWikiPluginMacro:

backporting - added render_macro

[2465] by permon on 2007-07-13 17:17:50
MediaWikiPluginMacro:

changed default link from '/link' to only 'link' - should work with default trac installation

[2464] by permon on 2007-07-13 17:02:31
MediaWikiPluginMacro:

initial commit

Author/Contributors

Author: permon
Maintainer: permon
Contributors: