[pmwiki-users] Numbered Sections cookbook recipe

Hans-Jürgen Godau juergen at godau-witten.de
Wed Nov 13 06:23:25 PST 2019


I wanted to have numbered sections in my wiki-page, so I tried the numbered
sections recipe and noticed, it still uses the deprecated "/e" Markup. so I
changed the source with the following diff's:
-------------------------
--- Downloads/archive/pmwiki/numberedsections.php
+++ numberedsections.php
@@ -88,8 +88,8 @@
 ##
 SDV ($DDNumFmt, '1.1.1.1.1.1');

-Markup('dd-num1','>include','/^(!{1,6})(?:\s*)(.*)$/e',
"DDMkNumTitle(PSS('$1'),PSS('$2'))");
-Markup('dd-num2','directives','/\\(:(no)?numbered-sections(?:\s+(.*?))?:\\)/e',
"DDRunNum('$1',PSS('$2'))");
+Markup('dd-num1','>include','/^(!{1,6})(?:\s*)(.*)$/', "DDMkNumTitle");
+Markup('dd-num2','directives','/\\(:(no)?numbered-sections(?:\s+(.*?))?:\\)/',
"DDRunNum");

 ##
 ## If numbered sections are enabled in the group or site header or footer,
ensure they are not inherited
@@ -101,8 +101,9 @@
 $SiteHeaderFmt = $SiteHeaderFmt.'(:nonumbered-sections:)';
 $SiteFooterFmt = '(:nonumbered-sections:)'.$SiteFooterFmt;

-
-function DDMkNumTitle ($prefix, $text) {
+function DDMkNumTitle ($m) {
+  $prefix=PSS($m[1]);
+  $text=PSS($m[2]);
   global $DDNumFmt, $DDNumHdrEnable, $DDFmtSet, $DDDebug;
   static $FmtNb, $OrNb, $TcNb, $sp, $numoffset, $CurLvl;

@@ -158,8 +159,10 @@
     return chr(ord($num)-1);
 }

-function DDRunNum ($nonum, $argstr) {
+function DDRunNum ($m) {
   global $DDNumHdrEnable, $DDFmtSet, $DDNumFmt, $DDDebug;
+  $nonum = $m[1];
+  $argstr = PSS($m[2]);

   $args = ParseArgs($argstr);
-------------------------
Maybe Petko could change this in the download-version?

Greetings,
Hans-Jürgen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20191113/4f4d0ec3/attachment.html>


More information about the pmwiki-users mailing list