[dokuwiki] Re: metadata clearing

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 14 Nov 2006 16:34:06 +0000

Esther Brunner wrote:


> - add a clear() method to the syntax plugin class.  DW would call that
> method for every syntax plugin prior to processing the instruction
> list.  Syntax plugins that wished to clear out their metadata could
> override the default method (which does nothing).

You mean, before rendering the instructions to XHTML the redirect
plugin could clear its metadata and while processing the instructions
re-adds it, if the redirect instruction is still there. I doubt
whether this is the most elegant solution.

No. I mean in p_render_metadata, after instantiating the renderer and assigning it the current metadata, but before looping through the wiki instructions. I agree though, its not an elegant solution.

Other alternatives are:
- wipe all metadata before re-rendering

Can all the metadata be easily reproduced by rendering the _current_
page? We currently do not use 'isreferencedby' and 'ispartof', but the
list of contributors might be a problem.
That is the problem - this method effectively kills the persistent metadata idea.

- allow metadata values to be (somehow) marked as persistent when
setting them. Values would not be persistent by default.  The renderer
would wipe all but persistent values before re-rendering.

I think this makes sense. But should this mark be stored with every
value in the metadata or should we rather provide a way for plugins to
register persistent metadata types?

The mechanism would be internal. Perhaps store two arrays of metadata. One persistent and one current. Get metadata would only look at the current array. Set would set in current and also in persistent if the persistent flag was set. The renderer would (at document start instruction) replace the current copy with the persistent version, thereby deleting all non-persistent values.

This mechanism would work for the last alternative as well. The only difference being the default value of a new "persistent" parameter in p_set_metadata(). My preference is default to non-persistent.

Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: