• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Since revision 11344 the preference parser (TWiki::Prefs::Parser.pm) adds useless spaces to the end of a value where it shouldn't because of this change:

-        } elsif( $type ) {
-            if( $line =~ /^(\s{3}|\t)+\s*[^\s*]/ &&
-                  $line !~ m/$TWiki::regex{bulletRegex}/o ) {
+        } elsif( defined $type ) {
+            if( /^(   |\t)+ */ && !/$TWiki::regex{bulletRegex}/o ) {

This code fragment analyzes the line after a preference setting and tries to decide if it is to be appended to the value or not like in

   * Set A_VAR = foo
   bar

sets A_VAR to

foo
   bar

The problem with the new regex /^(   |\t)+ */ is that it matches a continued value only consisting of spaces. So

   * Set B_VAR =
<space><space><space>
does not set B_VAR to the empty string but to

\n
<space><space><space>

... which is a bad way to be "white-space-sensitive".

The fix would be to check (as the original regex did) that there is at least one non-white-space following:

--- lib/TWiki/Prefs/Parser.pm   (revision 11375)
+++ lib/TWiki/Prefs/Parser.pm   (working copy)
@@ -75,7 +75,7 @@
             $key = $2;
             $value = (defined $3) ? $3 : '';
         } elsif( defined $type ) {
-            if( /^(   |\t)+ */ && !/$TWiki::regex{bulletRegex}/o ) {
+            if( /^(   |\t)+ *[^\s]/ && !/$TWiki::regex{bulletRegex}/o ) {
                 # follow up line, extending value
                 $value .= "\n".$_;
             } else {

CDot, as you've done the last checkin in that area, do you agree?

MD

Closed in 4.0.5 KJL

ItemTemplate
Summary preference parser adds empty lines
ReportedBy TWiki:Main.MichaelDaum
Codebase

SVN Range TWiki-4.1-beta1, Mon, 21 Aug 2006, build 11354
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins 11386 11388 11389
TargetRelease patch
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2006-11-14 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback