Thanks for sharing this.

 $prefix=PSS($m[1]);
 $text=PSS($m[2]);

You need to remove the PSS() calls from the new version. PSS() strips one level of backslashes. It was previously needed in markup replacements because preg_replace() with /eval added one level of backslashes. The new PHP 5.5-7.2 way doesn't add backslashes, and using PSS() may remove legitimate backslashes from the wiki text.

Maybe Petko could change this in the download-version?

If the maintainer is unreachable, as the recipe is licensed GPL, you can publish the changes yourself, and even take over the maintenance of the recipe.

BTW, if you also need a table of contents, the latest PmWiki version includes a new table of contents feature that can also automatically number sections, see $PmTOC['NumberedHeadings'] at this page:

  https://www.pmwiki.org/wiki/PmWiki/TableOfContents

Core numbered headings currently depend on the table of contents, but that should be refactored to become an independent function. Now, if the sections are less than 3 (configurable), there is no TOC and the headings are not numbered.

Petko

On 13/11/2019 15:23, Hans-Jürgen Godau wrote:
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?

_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to