[dokuwiki] Re: How to number headlines ?

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 06 Apr 2006 00:20:58 +0100

Chris Smith wrote:

It needs modifications to parts of the parser to work properly.
(1) Changes to header / section handling. I reckon they are improvements over the current methods so I'll package them up in a patch for Andi to look at.

Quick question before I do this.

At present, p_get_first_heading() (inc/parserutils.php) gets the first heading information by searching the document for the first header instruction. This works fine if your headers come from the dokuwiki native heading handler, but fails if headings are provided by some other mechanism.

Its also potentially inefficient as it needs to search the instruction list for a page until it find that first heading.

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).

Best regards,


[1]Potential uses could be:
language information

DokuWiki mailing list - more info at

Other related posts: