Skip to content

Commit

Permalink
Item14018: properly prevent duplicate processing
Browse files Browse the repository at this point in the history
... of the same heading
  • Loading branch information
MichaelDaum committed Mar 8, 2016
1 parent 35db5a4 commit 1420e02
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
10 changes: 10 additions & 0 deletions .gitignore
@@ -0,0 +1,10 @@
*.swp
*,v
igp_*
ExplicitNumberingPlugin.md5
ExplicitNumberingPlugin.sha1
ExplicitNumberingPlugin.tgz
ExplicitNumberingPlugin.txt
ExplicitNumberingPlugin.zip
ExplicitNumberingPlugin_installer
ExplicitNumberingPlugin_installer.pl
38 changes: 17 additions & 21 deletions data/System/ExplicitNumberingPlugin.txt
@@ -1,9 +1,7 @@
%META:TOPICINFO{author="ProjectContributor" date="1263951431" format="1.1" reprev="1.1" version="1.1"}%
<img src="%ATTACHURLPATH%/screenshot.png" alt="Example image" style="float:right" />

%META:TOPICINFO{author="ProjectContributor" date="1263951431" format="1.1" reprev="1.1" version="1"}%
---+ <nop>%TOPIC%

%SHORTDESCRIPTION%
<img src="%ATTACHURLPATH%/screenshot.png" alt="Example image" style="float:right" />
%FORMFIELD{"Description"}%

%TOC{depth="2"}%

Expand Down Expand Up @@ -138,21 +136,12 @@ Note: This plugin does not obtain preference settings from this topic. Settings
---++ See also
The Foswiki:Extensions.TocPlugin provides a more complete table of contents and cross-reference management.

---++ Plugin Installation Instructions
---++ Installation Instructions
%$INSTALL_INSTRUCTIONS%

---++ Plugin Info
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

| Plugin Author: | TWiki:Main.MartinVlach, Foswiki:Main.ThomasWeigert (21 Nov 2006) |
| Copyright: | &copy; 2003, Lynguent, Inc. &copy; 2006, %SYSTEMWEB%.ProjectContributor |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Plugin Version: | %$VERSION% |
| Plugin Release: | %$RELEASE% |
| Change History: | <!-- versions below in reverse order --> |
| 25 Aug 2011: | Foswikitask:Item11074 - added compatibility to newer foswikis (Foswiki:Main.MichaelDaum) |
---++ Change History
| 08 Mar 2016: | Foswikitas:Item14018 - properly prevent duplicate processing of the same heading (Foswiki:Main.MichaelDaum) |
| 25 Aug 2011: | Foswikitask:Item11074 - added compatibility to newer Foswikis (Foswiki:Main.MichaelDaum) |
| 04 May 2011: | Foswikitask:Item10435 - remove uncoditional debug message |
| 22 Feb 2010: | Foswikitask:Item2654 - internal changes compatible with trunk, Foswikitask:Item2665: various enhancements - added alpahbet setting for alpha sequence, Foswikitask:Item8493 - documentation enhancements |
| 4 Jun 2009: | Added a bold preference option; Foswikitask:Item8167 (Foswiki:Main.SallyHoughton) |
Expand All @@ -162,10 +151,17 @@ The Foswiki:Extensions.TocPlugin provides a more complete table of contents and
| 17 Sep 2003: | Added alpha-labeled lists. |
| 12 Aug 2003: | Initialize sequences in startRenderingHandler. Thank you TWiki:Main.IngoKarkat. |
| 29 Jul 2003: | Initial version |
| Home: | http://foswiki.org/Extensions/%TOPIC% |
| Support: | http://foswiki.org/Support/%TOPIC% |

__Related Topics:__ %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences, [[%SYSTEMWEB%.Plugins][Plugins]]

%META:FILEATTACHMENT{name="screenshot.png" attachment="screenshot.png" attr="h" comment="Screenshot Example" date="1223777089" path="screenshot.png" size="6179" user="ProjectContributor" version="1"}%

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="TWiki:Main.MartinVlach, Foswiki:Main.ThomasWeigert (21 Nov 2006)"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2003, Lynguent, Inc. &copy; 2006, %25SYSTEMWEB%25.ProjectContributor"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/%TOPIC%"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Release" title="Release" value="%$RELEASE%"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/%TOPIC%"}%
%META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/%TOPIC%"}%
%META:FIELD{name="Version" title="Version" value="%$VERSION%"}%
10 changes: 7 additions & 3 deletions lib/Foswiki/Plugins/ExplicitNumberingPlugin.pm
Expand Up @@ -26,13 +26,15 @@ use warnings;

our $NO_PREFS_IN_TOPIC = 1;

our $VERSION = '1.62';
our $RELEASE = '1.62';
our $VERSION = '1.63';
our $RELEASE = '08 Mar 2016';

# One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic:
our $SHORTDESCRIPTION =
"Use the ==#<nop>#.,== ==#<nop>#..== etc. notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text. Also support numbered headings.";

our $TRANSLATIONTOKEN = "\0ENP\0";

my $web;
my $topic;
my $user;
Expand Down Expand Up @@ -120,6 +122,8 @@ sub commonTagsHandler {
$_[0] =~
s/\#\#(\w+\#)?([[:digit:]]+)?\.(\.*)([[:alpha:]]?)/&makeExplicitNumber($1,$2,length($3),$4)/ge;
putBackBlocks( \$_[0], $removedTextareas, 'textarea', 'textarea' );

$_[0] =~ s/$TRANSLATIONTOKEN//g;
}

# =========================
Expand All @@ -136,7 +140,7 @@ sub makeHeading {
$numlevel .= '.';
}

return $result . '##' . $init . $numlevel . ' ';
return $result . '##' . $init . $numlevel . $TRANSLATIONTOKEN;
}

# Build the explicit outline number
Expand Down

0 comments on commit 1420e02

Please sign in to comment.