• 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.

Item3757: TWiki inserts html into text areas which have text in them

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Enhancement Closed   minor 4.1.3, 4.2.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

If a text area starts with text in it, TWiki will insert html such as <p />.

Test case at LitterTray.TextAreaTest.

-- TWiki:Main/AndrewRJones - 13 Mar 2007

Thought I would have a quick go to fix this myself. This little patch to Render.pm seems to work, and it still expands variables such as %MAINWEB%.

908d907
<     my $removedTextarea = {};
921,922d919
<     $text = $this->takeOutProtected( $text, qr/<textarea\b.*?<\/textarea>/si,
<                                      $removedTextarea );
1160d1156
<     $this->putBackProtected( \$text, $removedTextarea );

-- TWiki:Main.AndrewRJones - 13 Mar 2007

Thanks for the report and the patch - a context-diff patch would be more useful though, please see TWiki:Codev.PatchGuidelines.

-- TWiki:Main.RichardDonkin - 14 Mar 2007

Ok, here's a new patch using diff -c:

***************
*** 905,911 ****
      my $removedComments = {};
      my $removedScript = {};
      my $removedHead = {};
-     my $removedTextarea = {};
      my $removedVerbatim = {};
      my $removedLiterals = {};

--- 905,910 ----
***************
*** 918,925 ****
                                       $removedComments );
      $text = $this->takeOutProtected( $text, qr/<head.*?<\/head>/si,
                                       $removedHead );
-     $text = $this->takeOutProtected( $text, qr/<textarea\b.*?<\/textarea>/si,
-                                      $removedTextarea );
      $text = $this->takeOutProtected( $text, qr/<script\b.*?<\/script>/si,
                                       $removedScript );

--- 917,922 ----
***************
*** 1157,1163 ****

      $this->putBackProtected( \$text, $removedHead );
      $this->putBackProtected( \$text, $removedComments );
-     $this->putBackProtected( \$text, $removedTextarea );
      $this->{session}->{client}->endRenderingHandler( $text );

      $plugins->postRenderingHandler( $text );
--- 1154,1159 ----

-- TWiki:Main.AndrewRJones - 15 Mar 2007

commited to MAIN, with unit test.

-- TWiki:Main.SvenDowideit - 23 Mar 2007

Would this be a potential patch release fix also?

Or is it perhaps a risky fix with respect to compatibility?

-- TWiki:Main.KennethLavrsen - 23 Mar 2007

I don't think its a risky fix, in fact, done smile

-- TWiki:Main.SvenDowideit - 23 Mar 2007

Argh, this is hopeless. I have a plugin (and I am sure there are others) that tries to put a textarea into the text. But this change eats it!

Re-opening as urgent, as it breaks existing plugins.

To try it, just insert | <textarea> XYZ </textarea> | in a commonTagsHandler.

CC

See also: Item3874 for possibly related problem.

-- TWiki:Main.CrawfordCurrie - 13 Apr 2007

I added a unit test, and it seems to be working OK now, at least with my plugins. Need to keep an eye on this one, though!

CC

ItemTemplate
Summary TWiki inserts html into text areas which have text in them
ReportedBy TWiki:Main.AndrewRJones
Codebase 4.1.0, ~twiki4
SVN Range

AppliesTo Engine
Component

Priority Enhancement
CurrentState Closed
WaitingFor

Checkins TWikirev:13209 TWikirev:13216
TargetRelease minor
ReleasedIn 4.1.3, 4.2.0
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2008-01-22 - 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