[dokuwiki] Re: How to number headlines ?

  • From: "Esther Brunner" <wikidesign@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 6 Apr 2006 10:39:24 +0200

Hi Chris

> How about:
> (1) adding a new piece of meta data, meta['first_heading'].  If the
> value is empty, the native header syntax will fill that with the first
> heading it comes across.  Any alternate method of handling headings can
> do the same.  Then as long as everything behaves well, there will be no
> clashes and the first heading can be set by anything.
>
> (2) the first heading information gets added as the first instruction in
> the list by the _finalise handler.  This would guarantee that the first
> heading information is quickly accessible in every document.
>
> Taking this a step further, could all the page meta data get added to
> the first instruction in the page.  This opens up the possibility for
> native syntax modes and plugins to add page settings information in a
> controlled manner that could be used by other parts of dokuwiki simply
> by reading the first instruction.[1]
>
> Either this could be done by adding a new instruction at the start of
> the file - an instruction that has no output but fills the
> $renderer->meta array.  Or instead of adding a new instruction, add the
> meta data as the data for the current document_start instruction (it
> currently has uses data).

I also think this is an excellent idea! I was thinking many times,
that the current way we get the first heading and in my blog plugin
the tags, is not the best.

Maybe it might be better to save meta information in a separate file
data/meta/$id.meta (simply the serialised $meta array). Usually the
page contents comes from the xhtml cache and we probably don't want to
load the instruction cache for every page load as well but rather a
smaller .meta file. I also makes sense to use a separate file, because
for example when p_get_first_heading() gets the link title, it is not
interested in the instructions for rendering the contents of the page,
but only in some information about the page, namely the first heading.

One more use of the meta-feature would be the long standing request
for redirects. If DokuWiki finds a $meta['redirect'], it would
redirect to that ID before even reading the (cached) contents of the
page.

Best regards

-- esther

Other related posts: