Re: [pmwiki-users] Numbered Sections cookbook recipe
On 13/11/2019 15:56, Petko Yotov wrote: 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. For the next version, if both PmTOC and NumberedHeadings are enabled, but their number is less than MinNumber (see documentation), the headings will be numbered. It will be possible to only enable numbered headings and suppress the TOC by setting MinNumber to a very large number, something like this: $PmTOC = array( 'Enable' = 1, # still needed 'NumberedHeadings' => '1.A.a.i', # for example 'MinNumber' => 999, ); This is now in Subversion, I'll release 2.2.121 in the next few days. Petko ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Numbered Sections cookbook recipe
thank you. I will consider the new core feature, so maybe the recipe is made superfluous for me. Am Mi., 13. Nov. 2019 um 15:56 Uhr schrieb Petko Yotov <5...@5ko.fr>: > 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
Re: [pmwiki-users] Numbered Sections cookbook recipe
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
[pmwiki-users] Numbered Sections cookbook recipe
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 ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users