From 1420e02a0e12dd0680dc8bcf8194d34f391be44c Mon Sep 17 00:00:00 2001 From: MichaelDaum Date: Tue, 8 Mar 2016 17:26:01 +0100 Subject: [PATCH] Item14018: properly prevent duplicate processing ... of the same heading --- .gitignore | 10 +++++ data/System/ExplicitNumberingPlugin.txt | 38 +++++++++---------- .../Plugins/ExplicitNumberingPlugin.pm | 10 +++-- 3 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..60525c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.swp +*,v +igp_* +ExplicitNumberingPlugin.md5 +ExplicitNumberingPlugin.sha1 +ExplicitNumberingPlugin.tgz +ExplicitNumberingPlugin.txt +ExplicitNumberingPlugin.zip +ExplicitNumberingPlugin_installer +ExplicitNumberingPlugin_installer.pl diff --git a/data/System/ExplicitNumberingPlugin.txt b/data/System/ExplicitNumberingPlugin.txt index 6d8e493..fb23ede 100644 --- a/data/System/ExplicitNumberingPlugin.txt +++ b/data/System/ExplicitNumberingPlugin.txt @@ -1,9 +1,7 @@ -%META:TOPICINFO{author="ProjectContributor" date="1263951431" format="1.1" reprev="1.1" version="1.1"}% -Example image - +%META:TOPICINFO{author="ProjectContributor" date="1263951431" format="1.1" reprev="1.1" version="1"}% ---+ %TOPIC% - -%SHORTDESCRIPTION% +Example image +%FORMFIELD{"Description"}% %TOC{depth="2"}% @@ -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 - - -| Plugin Author: | TWiki:Main.MartinVlach, Foswiki:Main.ThomasWeigert (21 Nov 2006) | -| Copyright: | © 2003, Lynguent, Inc. © 2006, %SYSTEMWEB%.ProjectContributor | -| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | -| Plugin Version: | %$VERSION% | -| Plugin Release: | %$RELEASE% | -| Change History: | | -| 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) | @@ -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="© 2003, Lynguent, Inc. © 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%"}% diff --git a/lib/Foswiki/Plugins/ExplicitNumberingPlugin.pm b/lib/Foswiki/Plugins/ExplicitNumberingPlugin.pm index 8a1ba39..83ede50 100644 --- a/lib/Foswiki/Plugins/ExplicitNumberingPlugin.pm +++ b/lib/Foswiki/Plugins/ExplicitNumberingPlugin.pm @@ -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 ==##.,== ==##..== 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; @@ -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; } # ========================= @@ -136,7 +140,7 @@ sub makeHeading { $numlevel .= '.'; } - return $result . '##' . $init . $numlevel . ' '; + return $result . '##' . $init . $numlevel . $TRANSLATIONTOKEN; } # Build the explicit outline number