Feature Proposal: Add Angle Brackets (< and >) to Format Tokens
Motivation
Some Plugins use html like syntax to trigger there tags or for additional formatting. These tags can interfere with other plugin processing if inappropriately expanded.
Description and Documentation
- Add an escape "$lt" to FormattedSearch which allows protecting the "<" character from premature expansion.
- Add an escape "$gt" that expands to the ">" character in the same way.
Examples
To see the problem, use a search from
FormQueryPlugin that retrieves a bullet list or table from somewhere. To put that inside a table, you need to wrap a container around it, e.g., using
MultiEditPlugin. But that plugin performs some manipulation of its tag before the common tags handler, which in turn messes up what
FormQueryPlugin needs. Escaping the
<section> tag solves the problem, but we need to have a way of converting that back into the tag so that it can be properly expanded after the
FormQueryPlugin does its thing. This cannot be solved by plugin ordering, as the interactions are in the before common tags/common tags cycle.
Impact
Implementation
Add on line to
TWiki.pm:
Index: lib/TWiki.pm
===================================================================
RCS file: /proj/auto-CVS/SiteHelpers/twiki422/lib/TWiki.pm,v
retrieving revision 1.1.1.2
diff -r1.1.1.2 TWiki.pm
3062a3063
> $text =~ s/\$langle/\</gos; # expand left bracket
Documentation impact:
To be documented in
FormatTokens (PTh)
--
Contributors: ThomasWeigert - 2009-05-22
Discussion
If I understand correctly you'd like to have the replacement sequence for the '<' char found anywhere on a page resolved somewhere in the rendering pipeline. Where in the rendering do you need that (a unified diff might help).
As for name, the
HTML entity for '<' is
< as is "less-than". Possibly use
lt or
lessthan?
The $something syntax is so far only used in parameters of
TWikiVariables, such as in a
FormattedSearch. I am wondering if it would be better to use an existing syntax that we use outside of TWiki variable parmeters? For example we have a %NOP%. How about %LT% to make it orthogonal to the TWiki convention and
HTML entity name?
--
PeterThoeny - 2009-05-22
Sorry for the confusion. What I want is something like the standard escapes
$quot,
$percnt, etc., to be used precisely like these standard escapes (e.g., in formatted search).
I agree,
$lt will be a better syntax.
--
ThomasWeigert - 22 May 2009
OK, in this case it is a nobrainer. Here is the list of parameters I am aware of where we can add
$lt (see
Documentation imact).
Are there more variables?
--
PeterThoeny - 2009-05-23
For consistency I suggest to add also
$gt (greater-than), e.g. '>'.
To reflect the change, I renamed the page from AddLangleToStandardEscapes to
AddAngleBracketsToFormatTokens.
--
PeterThoeny - 2009-05-23
We have reached consensus in May 2009. Thomas, could you check-in the changes in svn trunk and 4.3 branch?
--
PeterThoeny - 2009-09-28
This is now implemented in trunk and 5.0 branch, tracked at
TWikibug:Item6483
--
PeterThoeny - 2010-06-06