Bug: Parsing of a formatted search breaks
When entering legal wiki constructions in a formatted search, not all of them are working. This is not a regular expression problem I believe. In particular
- linking of wiki words interferes
- and linking through the
[[...]] notation breaks.
Note that the first of these can be fixed by wraping
< noautolink>...< /noautolink> around the search.
Test case
Take a look at these two queries:
<noautolink>
<form action="%SCRIPTURLPATH%/search%SCRIPTSUFFIX%/%INCLUDINGWEB%/">
<input type="hidden" name="scope" value="True" />
<input type="hidden" name="web" value="Main" />
<input type="text" name="search" size="32" />
<input type="submit" value="Search" /> <br>
<input type="hidden" name="header" value="|*Installation*|*Description*|" />
<input type="hidden" name="format" value="|$web.$topic |$formfield(TypeOfOrganization) |" />
</form>
</noautolink>
<noautolink>
<form action="%SCRIPTURLPATH%/search%SCRIPTSUFFIX%/%INCLUDINGWEB%/">
<input type="hidden" name="scope" value="True" />
<input type="hidden" name="web" value="Main" />
<input type="text" name="search" size="32" />
<input type="submit" value="Search" /> <br>
<input type="hidden" name="header" value="|*Installation*|*Description*|" />
<input type="hidden" name="format" value="|[[$web.$topic][$formfield(TWikiInstalledAt)]] |$formfield(TypeOfOrganization) |" />
</form>
</noautolink>
Notice the garbage below the second query... Note that we can make the form come out right by prefixing each of the
[ symbols by a
\, but then the formatting of the query is incorrect, as the
\ is taken literally.
Environment
| TWiki version: |
Athens, Beijing |
| TWiki plugins: |
twiki.org |
| Server OS: |
|
| Web server: |
|
| Perl version: |
|
| Client OS: |
|
| Web Browser: |
IE |
--
ThomasWeigert - 04 May 2003
Follow up
This could be fixed, but is a quiet expensive runtime check for a special case. Better to escape problematic text with
<nop> which gets removed before the rendered text is returned to the browser. As in:
<form action="%SCRIPTURLPATH%/search%SCRIPTSUFFIX%/%MAINWEB%/">
<input type="hidden" name="scope" value="text" />
<input type="hidden" name="web" value="Main" />
<input type="text" name="search" size="32" />
<input type="submit" value="Search" />
<input type="hidden" name="header" value="|*View*|*Installation*|*Type*|" />
<input type="hidden" name="format" value="|[<nop>[$web.$topic][view]]|$formfield(<nop>TWikiInstalledAt) |$formfield(<nop>TypeOfOrganization) |" />
</form>
BTW, to make this example work nicely we'd need
SearchTopicNameAndTopicText.
--
PeterThoeny - 05 May 2003
Fix record