Index: lib/TWiki/Plugins/ExplicitNumberingPlugin.pm =================================================================== --- lib/TWiki/Plugins/ExplicitNumberingPlugin.pm (revision 17427) +++ lib/TWiki/Plugins/ExplicitNumberingPlugin.pm (working copy) @@ -39,9 +39,9 @@ $pluginName = 'ExplicitNumberingPlugin'; # Name of this Plugin -my $maxLevels = 6; # Maximum number of levels -my %Sequences; # Numberings, addressed by the numbering name -my $lastLevel = $maxLevels - 1; # Makes the code more readable +my $maxLevels = 6; # Maximum number of levels +my %Sequences; # Numberings, addressed by the numbering name +my $lastLevel = $maxLevels - 1; # Makes the code more readable my @alphabet = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); # ========================= @@ -79,8 +79,8 @@ %Sequences = (); - $_[0] =~ s/\-\-\-(\#\#*) /&makeHeading(length($1))/geo; - $_[0] =~ s/\#\#(\w+\#)?([0-9]+)?\.(\.*)([a-z]?)/&makeExplicitNumber($1,$2,length($3),$4)/geo; + $_[0] =~ s/^---+(\#+)/&makeHeading(length($1))/geom; + $_[0] =~ s/\#\#(\w+\#)?([0-9]+)?\.(\.*)([a-zA-Z]?)/&makeExplicitNumber($1,$2,length($3),$4)/geo; } # ========================= @@ -123,16 +123,16 @@ if ( ! defined( $Sequences{$name} ) ) { for $i ( 0 .. $lastLevel ) { $Numbering[$i] = 0; } } else { - @Numbering = split(':', $Sequences{$name} ); - #...Re-initialize the sequence - if ( defined $_[1] ) { - $init = (int $init); - if ( $init ) { - $Numbering[$level] = $init - 1; - } else { - for $i ( 0 .. $lastLevel ) { $Numbering[$i] = 0; } - } - } + @Numbering = @{$Sequences{$name}}; + #...Re-initialize the sequence + if ( defined $_[1] ) { + $init = (int $init); + if ( $init ) { + $Numbering[$level] = $init - 1; + } else { + for $i ( 0 .. $lastLevel ) { $Numbering[$i] = 0; } + } + } } #...Increase current level number @@ -144,17 +144,21 @@ } #...Save the altered numbering - $Sequences{$name} = join( ':', @Numbering ); + $Sequences{$name} = \@Numbering; #...Construct the number if ( $alist eq '' ) { - for $i ( 0 .. $level ) { - $text .= "$Numbering[$i]"; - $text .= '.' if ( $i < $level ); - } + for $i ( 0 .. $level ) { + $text .= "$Numbering[$i]"; + $text .= '.' if ( $i < $level ); + } } else { - #...Level is 1-origin, indexing is 0-origin - $text .= $alphabet[$Numbering[$level]-1] + #...Level is 1-origin, indexing is 0-origin + if ($alist =~ /[A-Z]/){ + $text .= uc $alphabet[$Numbering[$level]-1]; + } else { + $text .= $alphabet[$Numbering[$level]-1]; + } } return $text; Index: lib/TWiki/Plugins/ExplicitNumberingPlugin/MANIFEST =================================================================== --- lib/TWiki/Plugins/ExplicitNumberingPlugin/MANIFEST (revision 17427) +++ lib/TWiki/Plugins/ExplicitNumberingPlugin/MANIFEST (working copy) @@ -1,3 +1,2 @@ -data/TWiki/ExplicitNumberingPlugin.txt 0660 -lib/TWiki/Plugins/ExplicitNumberingPlugin.pm 0440 - +data/TWiki/ExplicitNumberingPlugin.txt 0644 +lib/TWiki/Plugins/ExplicitNumberingPlugin.pm 0644 Index: data/TWiki/ExplicitNumberingPlugin.txt =================================================================== --- data/TWiki/ExplicitNumberingPlugin.txt (revision 17427) +++ data/TWiki/ExplicitNumberingPlugin.txt (working copy) @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="mvlach" date="1063832959" format="1.0" version="1.8"}% +%META:TOPICINFO{author="TWikiContributor" date="1063832959" format="1.0" version="$Rev$"}% ---+ %TOPIC% Use the ==##.==, ==##..== _etc._ notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text. @@ -49,6 +49,8 @@ | Req ##a#....: | Req ##a#....: | Req 1.1.2.2: | | ##a#....a) | ##a#....a) | a) | | ##a#....a) | ##a#....a) | b) | +| ##A#....A) | ##A#....A) | A) | +| ##A#....A) | ##A#....A) | B) | | Req ##a#....: | Req ##a#....: | Req 1.1.2.3: | | Section ##a#.. | Section ##a#.. | Section 1.2 | | Chapter ##a#. | Chapter ##a#. | Chapter 2 | @@ -66,7 +68,7 @@ ---++ See also -There is an active development going on using the ---### notation for numbered headers. See TWiki:Codev.NumberedHeadersAndLists. +There is an active development going on using the =---###= notation for numbered headers. See TWiki:Codev.NumberedHeadersAndLists. The TWiki:Plugin.TocPlugin provides a more complete table of contents and cross-reference management. @@ -88,9 +90,12 @@ | Plugin Author: | TWiki:Main/MartinVlach, TWiki:Main.ThomasWeigert (21 Nov 2006) | | Copyright: | © 2003, Lynguent, Inc. © 2006, %TWIKIWEB%.TWikiContributor | | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | -| Plugin Version: | 21 Nov 2006 | +| Plugin Version: | 25 Aug 2008 | | Change History: |   | -| 21 Nov 2006: | Added reset to specific number based on suggestion by Main.SteveWampler. Added support of numbered headers. Proper handling in table of content. | +| 25 Aug 2008: | Fixed regular expression to parse enumerated headings (TWiki:Main.MichaelDaum). \ + Added support for upper-case alphabetic enumerations (TWiki:Main.DarrenElkerton) | +| 21 Nov 2006: | Added reset to specific number based on suggestion by TWiki:Main.SteveWampler. \ + Added support of numbered headers. Proper handling in table of content. | | 17 Sep 2003: | Added alpha-labeled lists. | | 12 Aug 2003: | Initialize sequences in startRenderingHandler. Thank you TWiki:Main.IngoKarkat. | | 29 Jul 2003: | Initial version | @@ -103,5 +108,6 @@ __Related Topics:__ %TWIKIWEB%.TWikiPreferences, %TWIKIWEB%.TWikiPlugins --- TWiki:Main.ThomasWeigert - 21 Nov 2006 +-- TWiki:Main.ThomasWeigert - 21 Nov 2006 %BR% +-- TWiki:Main.MichaelDaum - 25 Aug 2008