Item11925: Macro %TOPIC% stripped of % when used in Link Brackets within Template

Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: WysiwygPlugin
Reported By: JoeMarandola
Waiting For:
Last Change By: GeorgeClark
We have a template that contains link brackets. Within the brackets, we use the macro %TOPIC%. On creation of the new topic from the template, expect the %TOPIC% to be contained within the brackets. Instead the % signs are removed.

Here is the topic that utilizes the template
---++ Test Topic
_This topic creates the topic using the template._

 <form name="new" action="%SCRIPTURLPATH{"edit"}%/%WEB%/">
<input type="hidden" name="topic" value="BracketTopicAUTOINC01"  />
<input type="hidden" name="templatetopic" value="BracketTestTopicTemplate" />
<input type="hidden" name="onlywikiname" value="on" />
<input type="hidden" name="onlynewtopic" value="on" />
 <input type="submit"  class="foswikiSubmit"  value="Create" /></form>
Here is the template used
---+ Template with the macro %TOPIC% within link brackets
_It strips out the % within the link brackets on the creation of the topic_

   * %IF{"%CALC{"$EXISTS(%TOPIC%Checklist)"}% " then= '[[%TOPIC%Checklist][Checklist]]' else= ' <form name="new" action="%SCRIPTURLPATH{"edit"}%/%WEB%/">
<input type="hidden" name="topic" value="%TOPIC%Checklist"  />
<input type="hidden" name="templatetopic" value="BracketTestTopicTemplate" />
<input type="hidden" name="onlywikiname" value="on" />
<input type="hidden" name="onlynewtopic" value="on" /> 
<input type="submit"  class="foswikiSubmit"  value="Create" />
</form> Checklist' "}%

Similar to Item11924 which was corrected by upgrade of WysiwygPlugin to 1.1.12.

-- JoeMarandola - 04 Jun 2012

They are not stripped out, but for some reason, the TML2HTML process "protects" them and is supposed to restore them ... it does not. It leaves them protected as hex 03 characters, which should not slip through the conversion.

I've got a failing unit test that shows the problem but I'm not getting any closer to actually solving it.

-- GeorgeClark - 05 Jun 2012

Very simple bug, but almost 1am ... I'll get it fixed in the morning. In lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm,

sub _protectVerbatimChars {
 
-     # $TT0, $TT1 and $TT2 are chr(0), chr(1) and chr(2), respectively.
+     # $TT0, $TT1, $TT2 and $TT3 are chr(0), chr(1), chr(2) and chr(3), respectively
.     # They are handled specially, elsewhere
-    $text =~ s/([\003-\011\013-\037<&>'"])/'&#'.ord($1).';'/ges;
+    $text =~ s/([\004-\011\013-\037<&>'"])/'&#'.ord($1).';'/ges;
     $text =~ s/ /&nbsp;/g;

-- GeorgeClark - 05 Jun 2012

Released WysiwygPlugin 1.1.13 fixing this issue.

-- GeorgeClark - 05 Jun 2012
 

ItemTemplate edit

Summary Macro %TOPIC% stripped of % when used in Link Brackets within Template
ReportedBy JoeMarandola
Codebase
SVN Range
AppliesTo Extension
Component WysiwygPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:ba14c0f1e89b distro:6412273c0b4d
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:ba14c0f1e89b
Release01x01Checkins distro:6412273c0b4d
Topic revision: r6 - 05 Jun 2012, GeorgeClark
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License