[dokuwiki] editsections plugin and latest dokuwiki version

  • From: Christophe Drevet <dr4ke@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 28 Nov 2010 15:23:16 +0100

Dear list,

I have some questions for you guys. I'll start by a technical
description of what my plugin does and how. Then will come the issue
i'm facing. Then, the questions...

I. DESCRIPTION

I am the current author of the 'editsections' plugin. I rewrote the
plugin from ben coburn code. This plugin "moves" EDIT buttons on the
header of the edited section. It can also edit all subsections of the
current section (nested mode.) It tries to reproduce the 'MediaWiki'
behavior regarding section editing.

As the behavior of dokuwiki is exactly opposite (edit button at the
end of the section), this plugin adds a fake section at the very
beginning of the wiki page. This section is invisible to the user but
permit to display an EDIT button at its end. We use each end EDIT
button as the start EDIT button by moving it on the header of the
following section and changing values according to the sections really
edited.

How it is done :
o at 'PARSER_HANDLER_DONE' :
. add a fake section before all others. dokuwiki will then make a new
edit button at the end of this fake section and we will use it to be
the button for the first section
. store some values about all sections :
.. start
.. end
.. name
. change values of the last section to disable its edit button

o at 'HTML_SECEDIT_BUTTON' :
. calculate start and end of the section (including subsection in the
nested mode) for each button
. set correct name

A CSS is used to move down buttons

II. ISSUE

The cache feature of dokuwiki stores a preparsed version of the page.
As I didn't find a way to store all values in this page, the edit
buttons are inconsistent when using cache.
The issue is that I can't change the way the edit sections values are
stored in the cache. Then, for now, I disable it completely for my
plugin to really work as expected.

I can't think of a way to do what I want without, either :
. disabling cache
. catch the event RENDERER_CONTENT_POSTPROCESS and rewrite <!-- EDIT
--> comments with useful values
. change dokuwiki code

The first two options are bad as they introduce more processing each
time the page is viewed. The third can be done in two ways :
o implement two new events that could modify the way startSectionEdit
and finishSectionEdit works. The editsections plugin will use these
hooks to rewrite useful values before storing the page in cache.
o implement a standard option into dokuwiki to choose section editing behavior :
. one section, edit button at end of section (current behavior)
. one section, edit button at the beginning of each section
. nested sections, edit button at the beginning of each section

III. QUESTIONS

Is there a way to implement this plugin without touching dokuwiki core ?

If not, which way would be better : new hooks or implementing section
editing behavior in the core ? I can provide patches for one or both
ways.

Thanks for reading.

-- 
Christophe.
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: