Motivation
There are cases you want to replace a newline with <br/>.
But
%ENCODE{...}% cannot do it.
Description and Documentation
SEARCH{...},
FORMFIELD{...}%, and
INCLUDE{...} variables have
newline="..." parameter to replace newlines in the result with something else.
For symmetricity,
ENCODE{...} needs
newline="..." too.
At first, I thought to introduce a new encode type nl2br and make it available to both
SEARCH{...} and
ENCODE{...}.
Then
PeterThoeny pointed out
SEARCH{...} has
newline="..." already and then I realized that
INCLUDE{...} and
FORMFIELD{...} have it too.
Examples
%ENCODE{"..." type="entity" newline="$br"}%
Impact
Implementation
--
Contributors:
Hideyo Imazu - 2014-03-25
Discussion
This is a minor "no-brainer" enhancement that could be done without a feature proposal. As for token name,
n2br might be better to align with
\n and
$n used elsewhere.
Having said that, the SEARCH already has a
newline="%BR%" parameter. Does that address your need?
--
Peter Thoeny - 2014-03-25
I forgot about newline="%BR%" parameter of SEARCH{...}, which satisfies my immediate need.
SEARCH's newline is not only for $text but also for $pattern(...) and $formfield(...) so the newline parameter is to stay.
So I started thinking to introduce the newline="..." parameter to ENCODE{...}.
What do you think?
--
Hideyo Imazu - 2014-03-27
When keeping this proposal think it is better to have an
ENCODE type="n2br" as you initially suggested instead of a
newline="..." parameter to ENCODE, because the new encoding type will be available automatically in
ENCODE,
FORMFIELD,
$formfield(), etc.
--
Peter Thoeny - 2014-03-27
As per our conversation in the previous release meeting, I've renamed this topic and updated the proposal accordingly.
--
Hideyo Imazu - 2014-04-10