[pmwiki-users] Bugs in TextSection and MakePageName

Hans design5 at softflow.co.uk
Wed Feb 13 04:53:36 CST 2008


I think I found a bug in function TextSection (pmwiki.php):

The function did not return the correct text when using the suffix
..#section to  a pagename, which should return all text up to anchor
[[#section]].

The preg-match pattern does not match this input.

Changing this

  if (!preg_match("/#($npat)?(\\.\\.)?(#($npat)?)?/", $sections, $match))
    return $text;
  @list($x, $aa, $dots, $b, $bb) = $match;

to this

  if (!preg_match("/(#|\\.\\.)($npat)?(\\.\\.)?(#($npat)?)?/", $sections, $match))
    return $text;
  @list($x, $a, $aa, $dots, $b, $bb) = $match;

solved the problem.

I would like that this function not only returns the (section) text,
but also the position it calculates the text to be in regards to the
whole page text.

I need that for placing a manipulated section back into the whole
text. Fox is doing this, and I now had to create a slightly modified
version of TextSection in order to get the section position.

Related to this I think there is also a bug in function MakePageName:
It appears that MakePageName does not deliver a pagename if the name
supplied has a suffix '..#section'. It strips off any other anchor
suffix, but not this one.


  ~Hans   




More information about the pmwiki-users mailing list