Apparently in an attempt to protect against newlines or other characters messing up TWiki tables when formfield values are extracted using META{formfield...}, the value stored in the formfield is altered (newlines are replaced by <br />, vertical bars are replaced by their code, etc.).
However, when using these fields in a context where these characters are not causing problems, this rewriting results in that bullet lists or tables in form fields are not rendered correctly.
Suggestion: add an option to META{formfield...}, say
raw
, which does not do this protective rewriting, as in this patch:
*** /e/www/twiki-dakar-4.0.2/lib/TWiki/Render.pm~ Sat Jul 1 22:06:05 2006
--- /e/www/twiki-dakar-4.0.2/lib/TWiki/Render.pm Sun Jul 2 22:06:16 2006
***************
*** 216,225 ****
my $text = '';
my $name = $attrs->{name};
$text = renderFormFieldArg( $meta, $name ) if( $name );
! # change any new line character sequences to <br />
! $text =~ s/\r?\n/ <br \/> /gos;
! # escape "|" to HTML entity
! $text =~ s/\|/\&\#124;/gos;
return $text;
}
--- 216,228 ----
my $text = '';
my $name = $attrs->{name};
$text = renderFormFieldArg( $meta, $name ) if( $name );
! ### TW: Add "raw" option
! unless ( $attrs->{raw} ) {
! # change any new line character sequences to <br />
! $text =~ s/\r?\n/ <br \/> /gos;
! # escape "|" to HTML entity
! $text =~ s/\|/\&\#124;/gos;
! }
return $text;
}
VarSEARCH has
newline
parameter that can be set to
\n
or
%BR%
or any other string depending on circumstances.
While there is nothing wrong with a
raw
parameter imho, perhaps just adding
newline
and
verticalbar
parameters to both META and SEARCH instead would be more versatile (at the same time keeping them feature-aligned)? These are the two chars causing the most trouble (though for XML purposes
&
,
<
,
>
and
"
comes nearly as close :-)).
(The
newline
parameter to SEARCH is implemented, but doc is missing, see
Item2565).
--
SP
Any other opinions on this?
--
SP
OK. Good idea. I have implemented this and am testing... --
TW
Updated doco and checked in.
--
TW
There was a link to this from
TWiki:Codev.WhatIsIn04x01
. I see that there is a simple solution and I see no objections and nothing to discuss at release meetings. I just mark it as done in
TWiki:Codev.WhatIsIn04x01
.
--
KJL
Headline update for Rel note
KJL
4.1.0 released
KJL