wiki:MediaWikiPluginMacro

Version 5 (modified by anonymous, 16 years ago) (diff)

--

MediaWiki language processor

Notice: This plugin is unmaintained and available for adoption.

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 [download:mediawikipluginmacro here].

Installation

unzip mediawikipluginmacro.zip
cd mediawikipluginmacro
### next step (patch) only for python 2.3
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

17832 by rjollos on 2020-08-10 18:46:57
TracMediaWikiMacro 1.1dev: Fix multiple issues

  • Fixed issue where _specialUrlPat regex in replaceFreeExternalLinks was failing to render external links in paragraphs containing newlines because the re.DOTALL regex flag was not being used to allow .* to match newlines.
  • Fixed bug in replaceFreeExternalLinks where the loop variable i was being stepped on for another purpose by code inside the loop.
  • Fixed regex issue where control-char ranges for ascii were being specified to match against unicode strings.
  • Fixed issue where nextItem was called with only one rather than the required two parameters.
  • Support rendering of anchor links such as: [[#heading 4|heading four]]

Patch by James Yonan.

Untested by committer.

Refs #3382.

17387 by rjollos on 2019-06-25 19:55:46
TracMediaWikiMacro 1.1dev: Fix parsing error for <

Refs #4172.

17386 by rjollos on 2019-06-25 19:52:11
TracMediaWikiMacro 1.1dev: Applied patch attached to wiki page

Refs #4172.

(more)

Author/Contributors

Author: permon
Contributors: