Tags:
create new tag
, view all tags

Bug: Form rendering is too sensitive to whitespace

When protecting form rendering from newlines by translating those to <br /> , we are running into the problem that twiki ML must be preceded by whitespace. However, if the word after the newline starts or ends with a wiki ML, this ML ends up directly adjacent to a bracket character and is disabled. The rendered text will show the ML, rather than the rendered text. Leaving a white space before and after solves the problem, but is unintuitive to the user who has not seen the code.

Test case

Please see WhiteSpaceIssue

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  

-- ThomasWeigert - 17 Feb 2005

Impact and Available Solutions

Follow up

Can you give a bit more context? Is this when forms are displayed in view? Or edited? Or when they are searched?

A test case would be very helpful.

-- CrawfordCurrie - 18 Feb 2005

Sorry, I thought above was pretty clear. Anyway, please see the above test case...

Against cairo the following would solve this problem

Index: lib/TWiki/Render.pm
===================================================================
RCS file: /e/www/CVS/twiki-cairo/lib/TWiki/Render.pm,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 Render.pm
*** lib/TWiki/Render.pm   26 Dec 2004 12:10:35 -0000   1.1.1.2
--- lib/TWiki/Render.pm   19 Feb 2005 04:04:07 -0000
***************
*** 261,267 ****
          foreach my $field ( @fields ) {
              my $title = $field->{"title"};
              my $value = $field->{"value"};
!             $value =~ s/\n/<br \/>/g;      # undo expansion
              $metaText .= "|  $title:|$value  |\n";
          }
          $metaText .= "\n</div>";
--- 261,267 ----
          foreach my $field ( @fields ) {
              my $title = $field->{"title"};
              my $value = $field->{"value"};
!             $value =~ s/\n/ <br \/> /g;      # undo expansion
              $metaText .= "|  $title:|$value  |\n";
          }
          $metaText .= "\n</div>";

The added space prevents any wiki ML to touch up against a > or < character and does not affect the rendering.

However, please consider the additional bug fix in FilterFormFieldForIllegalCharacters. (There MartinCleaver also mentioned that TWiki has moved on so far that patches against cairo are not relevant any more frown ).

-- ThomasWeigert - 18 Feb 2005

can this patch be applied and this topic closed?

-- WillNorris - 02 May 2005

This particular behavior is now fixed in Dakar. However, a new problem appeared now: If you make the content of a cell exclusively a bold faced text, then this cell will be formatted as a header cell.

-- ThomasWeigert - 02 May 2005

Fix record

Can provide, if needed.

Discussion

Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2005-06-05 - WillNorris
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.