[pmwiki-users] extract

Hans design5 at softflow.co.uk
Fri Aug 21 15:59:27 CDT 2009


Friday, August 21, 2009, 7:37:36 PM, Patrick Ogay Evolution wrote:

> Actually an other person from the pmwiki chat, would be interested to
> have line nr and we are wondring, from design, wether an extention to
> have line #

line numbering is a tough one, because TextExtract allows formatting,
so for instance {(extract Test Test.*)} will pick up a line like

!!!Test

and shows it as  a level three heading.
Same goes for list items.

If we put  a line number in front that formating will be destroyed.
But we could put the line number in  aline above.

Please try this modification to extract.php:

Add _after_ line 219 ( $pagecount = 0; ) this line:

  $linecount = 0;

Add _before_  line 343 ( $newrows[] = $row; ) these lines:

  if ($opt['numbering']) {
     $linecount++;
     $newrows[] = "(:spacer:)%{$opt['numbering']}%".$linecount.".%% ";
  }

Then test by adding a parameter numbering=green to the extract expression
or extract markup. 'green' will be the wiki style of the line number.

You see I added a  %{$opt['numbering']}% wiki style to the number,
so one can specify the number style with the number parameter,
at the same time enabling the line numbers.
numbering=green results in injection of
%green%nn%%, nn being the line (result row) number.

Note also that the total line numbers and result numbers can vary,
as there can be more than one result per line.

Please test and comment, suggestions welcome!

  ~Hans




More information about the pmwiki-users mailing list