Feature Proposal: Escape quotes option in ICON
Motivation
Tasks.Item2181
ICON cannot be used inside a SEARCH because it uses double quotes.
In
Item2181 it was changed to single quotes. Then we broke IF. We cannot win with any of the two.
The only way to get a good solution is to keep things as they have always been by default so we do not break people current working applications and extend the ICON feature so future applications can use it also in a SEARCH and other places.
Description and Documentation
The proposal is simple.
We add an option called quotes with 4 possible values
%ICON{"name" quotes="value"}%
quotes |
Description |
double |
all quotes are " (default) |
single |
all quotes are ' |
escape |
all quotes are \" |
quot |
all quotes coded as $quot |
Examples
%ICON{"stop" quotes="single"}%
Implementation
The code should be fairly simple to implement and test and write unit tests for.
--
Contributors: KennethLavrsen - 06 Jan 2010
Discussion
First reaction; this is a terrible idea. Yet another way of managing quotes is not a good solution. I'm not quite clear what the original problem was -
Tasks.Item2181 lacks sufficient detail - There are a number of other possible approaches that would probably be be better:
- Delay expansion of %ICON until the search is complete
- Don't use quotes in the HTML generated by %ICON (this is perfectly valid HTML, albeit not valid XHTML)
- Add
$icon
to the search formats
- Support outside-in evaluation, as discussed elsewhere
--
CrawfordCurrie - 06 Jan 2010
An
$icon
format token would be ideal.
--
PaulHarvey - 07 Jan 2010
It is a good point that for the people needing a solution for SEARCH using $percntICON....$percnt will do the job. So maybe the problem is not so important to solve. Maybe a simple docu hint in
VarICON giving an example of doing this in a SEARCH will do the job for most.
--
KennethLavrsen - 07 Jan 2010
Actually, having ICON inside a format string is more common than having it inside an IF. So I'd prefer to make it emit single quotes. $percntICON...$percnt is an option for IF as well.
Some feedback from users: they don't use %ICON for exactly the reason addressed in Task:2181 it disturbs format strings during inside-out parsing.
--
MichaelDaum - 07 Jan 2010
It destroyed one of our own uses so IF is not uncommon.
Second you cannot know how many places our many many users have used it in applications where the single quotes gets goofed. One thing is for sure. We would have broken many wiki applications. I have examples at Motorola where we have used single quotes around things because we needed quotes inside quotes.
We are forced to keep what we have and address the original issue in a compatible way
This proposal was an attempt to address the issue. I am ready to pull it back for a better proposal. But we are not going to reapply something we KNOW will break things for people. Especially because people building application will always copy something they see work and they get inspired from it. They will have seen our own use of ICON and will have used it verbatim or very similar. We have been through these compatibility issues so many times. We must learn from it.
I also thought the quotes change was safe when Crawford checked it in. I saw it and thought it was OK. But then the bug reports came from the release candidate and we got more clever. Good I did the release candidate so we caught it.
--
KennethLavrsen - 07 Jan 2010
After having throught this through, I pull back the proposal as I agree with the raised concerns.
Good feedback and good arguments Michael and Crawford.
--
KennethLavrsen - 17 Feb 2010