Item8167: Adding Bold feature to ExplicitNumberingPlugin

pencil
Priority: Enhancement
Current State: Closed
Released In:
Target Release:
Applies To: Extension
Component: ExplicitNumberingPlugin
Branches:
Reported By: Foswiki:Main.SallyHoughton
Waiting For: Main.WillNorris, Main.ThomasWeigert
Last Change By: WillNorris
My users wanted a way of having the numbers in bold font, so I've added the following to this extension and it seems to work fine (may not be the best perl code, but hey!

wiki # diff -c ExplicitNumberingPlugin.pm ExplicitNumberingPlugin.pm.orig
*** ExplicitNumberingPlugin.pm  Fri May 29 16:57:07 2009
--- ExplicitNumberingPlugin.pm.orig    Wed Mar  4 02:20:40 2009
***************
*** 23,29 ****
  # =========================
  use vars qw(
    $web $topic $user $installWeb
!   $debug $bold
  );

  use strict;
--- 23,29 ----
  # =========================
  use vars qw(
    $web $topic $user $installWeb
!   $debug
  );

  use strict;
***************
*** 66,72 ****
      }

      $debug = Foswiki::Func::getPreferencesFlag("EXPLICITNUMBERINGPLUGIN_DEBUG");
-     $bold  = Foswiki::Func::getPreferencesFlag("EXPLICITNUMBERINGPLUGIN_BOLD");

      # Plugin correctly initialized
      ##Foswiki::Func::writeDebug( "- Foswiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK" ) if $debug;
--- 66,71 ----
***************
*** 181,190 ****
          }
      }

-     # do we want it bold or not?
-     if ( $bold ) {
-       $text =~ (s/$text/\*$text\*/) ;
-     }
      return $text;
  }

--- 180,185 ----

I don't know how to get this into the code tree (or use SVN), so I'm putting it here - hope that's okay.

-- SallyHoughton - 29 May 2009

i would be happy to patch ExplicitNumberingPlugin for you, but this submitted patch needs a few more things:
  1. an update to data/System/ExplicitNumberingPlugin.txt with some documentation on the new flag
  2. an update to data/System/ExplicitNumberingPlugin.txt with updated history (the table at the end of the topic)
  3. (your patch is backwards; reverse your arguments to diff)

after you have made these changes, please set this item to "Waiting For Feedback" and "Main.WillNorris" and i will promptly apply an updated patch. Thank you.

-- WillNorris - 31 May 2009

Hi Will, thanks for that -- here are the few more things;

1 & 2. patch to data/System/ExplicitNumberingPlugin.txt
fnet-rio1 # diff -c ExplicitNumberingPlugin.txt.orig ExplicitNumberingPlugin.txt
*** ExplicitNumberingPlugin.txt.orig   Wed Mar  4 02:20:40 2009
--- ExplicitNumberingPlugin.txt Thu Jun  4 11:51:26 2009
***************
*** 1,4 ****
! %META:TOPICINFO{author="ProjectContributor" date="1234433463" format="1.1" reprev="1.2" version="1.2"}%
  ---+ <nop>%TOPIC%

  Use the ==#<nop>#.==, ==#<nop>#..== _etc._ notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text.
--- 1,4 ----
! %META:TOPICINFO{author="BaseUserMapping_333" date="1244112686" format="1.1" reprev="1.2" version="1.2"}%
  ---+ <nop>%TOPIC%

  Use the ==#<nop>#.==, ==#<nop>#..== _etc._ notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text.
***************
*** 70,75 ****
--- 70,77 ----
        * Set SHORTDESCRIPTION = Use the ==#<nop>#.==, ==#<nop>#..== _etc._ notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text. Support also numbered headings.
     * Debug plugin: (See output in =data/debug.txt=)
        * Set DEBUG = 0
+    * Bold font the numbering sequence
+       * Set BOLD = 0

  ---++ See also
  The Foswiki:Extensions.TocPlugin provides a more complete table of contents and
***************
*** 90,95 ****
--- 92,98 ----
  |  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
  |  Plugin Version: | 12 Feb 2009 |
  |  Change History: | <!-- versions below in reverse order -->&nbsp; |
+ |  4 Jun 2009: | Added a bold preference option; Foswikitask:8167 (Foswiki:Main.SallyHoughton) |
  |  3 Mar 2009: | Exclude textareas from rendering to improve compatibility with EditChapterPlugin.  Completed rename to Foswiki namespace (Foswiki:Main.GeorgeClark);   Foswikitask:1038 |
  |  12 Feb 2009: | Fixed regular expression to parse enumerated headings (Foswiki:Main.MichaelDaum); \
                    Added support for upper-case alphabetic enumerations (TWiki:Main.DarrenElkerton) |

3. patch to lib/Foswiki/Plugins/ExplicitNumberingPlugin.pm
diff -c ExplicitNumberingPlugin.pm.orig ExplicitNumberingPlugin.pm
*** ExplicitNumberingPlugin.pm.orig    Wed Mar  4 02:20:40 2009
--- ExplicitNumberingPlugin.pm  Fri May 29 17:26:56 2009
***************
*** 23,29 ****
  # =========================
  use vars qw(
    $web $topic $user $installWeb
!   $debug
  );

  use strict;
--- 23,29 ----
  # =========================
  use vars qw(
    $web $topic $user $installWeb
!   $debug $bold
  );

  use strict;
***************
*** 66,71 ****
--- 66,72 ----
      }

      $debug = Foswiki::Func::getPreferencesFlag("EXPLICITNUMBERINGPLUGIN_DEBUG");
+     $bold  = Foswiki::Func::getPreferencesFlag("EXPLICITNUMBERINGPLUGIN_BOLD");

      # Plugin correctly initialized
      ##Foswiki::Func::writeDebug( "- Foswiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK" ) if $debug;
***************
*** 180,185 ****
--- 181,190 ----
          }
      }

+     # do we want it bold or not?
+     if ( $bold ) {
+       $text =~ (s/$text/\*$text\*/) ;
+     }
      return $text;
  }

-- SallyHoughton - 04 Jun 2009

thanks, sally. patch applied and plugin re-releasedd.

-- WillNorris - 08 Jun 2009

 

ItemTemplate edit

Summary Adding Bold feature to ExplicitNumberingPlugin
ReportedBy Foswiki:Main.SallyHoughton
Codebase 1.0.5
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component ExplicitNumberingPlugin
Priority Enhancement
CurrentState Closed
WaitingFor WillNorris, ThomasWeigert
Checkins ExplicitNumberingPlugin:694b70db6643
ReleasedIn
Topic revision: r5 - 08 Jun 2009, WillNorris
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy