How to make dokuwiki a good mediawiki

From Linuxintro
Revision as of 09:03, 4 February 2012 by imported>ThorstenStaerk (→‎See also)

Comparing dokuwiki and mediawiki I come to the result that

mediawiki has the advantages

  • look and feel
  • known markup language
  • edit buttons are above the section to be edited

while dokuwiki has the advantages

  • ACL's allow me to keep pages invisible
  • backup is easy because it is plain files

Even worse, migrating your users from mediawiki to dokuwiki will be quite a challenge if you disrupt their habits, e.g. by changing a wiki's look-and-feel.

Combining both

So to get to my perfect wiki there are two basic ways:

  • use mediawiki and patch/extend it until is can do ACL's. Accept that for a backup, a script is needed.
  • use dokuwiki and patches/plugins/skins until it looks like mediawiki and uses mediawiki's markup

Reading this discourages going the first path with authorization extensions. So the only way to secure mediawiki would be to set up several mediawiki instances, an internal one, a public one and so on. This provokes so many problems that I decided not to go this way. The problems are:

  • you will have to do "recent changes" on both mediawiki instances in order to see the complete picture
  • you will have to search on both mediawiki instances
  • with two mediawiki instances, it is still not possible to have one page public to group A, and another one visible to group B.

Adapting dokuwiki

Look and feel


What stays is to modify dokuwiki to get mediawiki's look-and-feel and its syntax. To do this, use the monobook template, it resembles to mediawiki

lib/tpl # wget --no-check-certificate
  • extract it to lib/tpl
lib/tpl # tar xvf 2011-12-10_monobook-update.tar.gz 
  • rename it to default
lib/tpl # mv default/ default-save
lib/tpl # mv monobook/ default
  • set admin -> Configuration Settings -> Load 'monobook/user/user.js'
  • adapt :wiki:navigation to contain
* [[:start]]
* [[http://yourhost/dokuwiki/doku.php?do=recent|Recent Changes]]
* [[http://yourhost/dokuwiki/doku.php?id=wiki&do=admin&page=statistics|Statistics]]

Edit buttons

The next hindering thing in day-to-day operation will be the "edit" buttons. Mediawiki users are used to "edit" buttons that edit the section below them, not above them. To get re-arrange the buttons in a mediawiki, there is the EditSections Plugin. If this does not work again, you can also apply this simple patch:

--- dokuwiki-1/inc/parser/xhtml.php     2011-06-14 21:58:54.000000000 +0200
+++ dokuwiki/inc/parser/xhtml.php       2011-07-10 18:09:07.000000000 +0200
@@ -183,6 +190,7 @@ class Doku_Renderer_xhtml extends Doku_R
         $this->doc .= '><a name="'.$hid.'" id="'.$hid.'">';
         $this->doc .= $this->_xmlEntities($text);
+        $this->finishSectionEdit();
         $this->doc .= "</a></h$level>".DOKU_LF;

No matter if you decide to use the EditSections Plugin or the above patch, you will have to apply a patch so that dokuwiki does not highlight the section above the edit button when you move your mouse over it (the edit button, that is). Here is the patch:

--- dokuwiki-1/lib/scripts/script.js    2011-06-14 21:58:54.000000000 +0200
+++ dokuwiki/lib/scripts/script.js      2011-07-10 13:42:07.000000000 +0200
@@ -550,37 +550,3 @@ addInitEvent(function(){
- * Highlight the section when hovering over the appropriate section edit button
- *
- * @author Andreas Gohr <>
- */
-    var btns = getElementsByClass('btn_secedit',document,'form');
-    for(var i=0; i<btns.length; i++){
-        addEvent(btns[i],'mouseover',function(e){
-            var tgt = this.parentNode;
-            var nr = tgt.className.match(/(\s+|^)editbutton_(\d+)(\s+|$)/)[2];
-            do {
-                tgt = tgt.previousSibling;
-            } while (tgt !== null && typeof tgt.tagName === 'undefined');
-            if (tgt === null) return;
-            while(typeof tgt.className === 'undefined' ||
-                  tgt.className.match('(\\s+|^)sectionedit' + nr + '(\\s+|$)') === null) {
-                if (typeof tgt.className !== 'undefined') {
-                    tgt.className += ' section_highlight';
-                }
-                tgt = (tgt.previousSibling !== null) ? tgt.previousSibling : tgt.parentNode;
-            }
-            if (typeof tgt.className !== 'undefined') tgt.className += ' section_highlight';
-        });
-        addEvent(btns[i],'mouseout',function(e){
-            var secs = getElementsByClass('section_highlight');
-            for(var j=0; j<secs.length; j++){
-                secs[j].className = secs[j].className.replace(/section_highlight/g,'');
-            }
-        });
-    }


Your users will be familiar with mediawiki syntax, so give it to them. MediaSyntax allows you to do this. It also contains a converter in case you have an existing base of articles in dokuwiki's syntax.


Want to see this all in action? Look here.

See also