You are here: Foswiki>Tasks Web>Item10242 (05 Jul 2015, GeorgeClark)Edit Attach

Item10242: Exclamation mark does not work the same as the HTML nop when parenthesis are involved.

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: FoswikiRender
Branches: master
Reported By: WryFi
Waiting For:
Last Change By: GeorgeClark
One of the ways to escape a macro is to prepend it with a bang (!).

Normally this works fine, e.g.
  • %SYSTEMWEB%

However, if I want to put the same text in parenthesis, the bang fails to escape the macro, e.g.
   * (!%SYSTEMWEB%)
  • (%SYSTEMWEB%)

Since nop tags can be used to accomplish the same, marking this low priority.

-- WryFi - 11 Jan 2011

raising to normal - as it shows that the renderer/parser is being inconsistent.

we should convert all the synonyms for NOP to one form right at the beginning, and thus deal with them identically.

-- SvenDowideit - 09 Mar 2011

The ! Normally escapes wikiwords. I did not we had a spec that made it escape the expansion of a macro. Where is that documented and is it correct?

-- KennethLavrsen - 09 Mar 2011

This function has been in the code since original import.
commit cd9c3f9d90142efd713de5addc2c35afd83aac96
Author: CrawfordCurrie <CrawfordCurrie@0b4bb1d4-4e5a-0410-9cc4-b2b747904278>
Date:   Wed Nov 19 13:40:25 2008 +0000

    Item175: First bulk rename pass. Note: not quite ready yet
    
    git-svn-id: http://svn.foswiki.org/trunk@809 0b4bb1d4-4e5a-0410-9cc4-b2b747904278

diff --git a/core/lib/Foswiki.pm b/core/lib/Foswiki.pm
--- /dev/null
+++ b/core/lib/Foswiki.pm
@@ -0,0 +2789,2 @@
+    # Escape ' !%VARIABLE%'
+    $$text =~ s/(?<=\s)!%($regex{tagNameRegex})/&#37;$1/g;

So if anything we need to document it, not remove it. The regex could use some tweaking as well to be a bit more generous in what it escapes. Any non-space character in front of the ! disables the escaping. Another option is to deprecate use of ! to escape macros, and document that %<nop%gt;MACRO% is the recommended solution.
  • %SYSTEMWEB%.!%TOPIC% becomes: System.%TOPIC%
  • =!%SYSTEMWEB%= becomes: !System

-- GeorgeClark - 04 Jan 2015
 

ItemTemplate edit

Summary Exclamation mark does not work the same as the HTML nop when parenthesis are involved.
ReportedBy WryFi
Codebase 1.2.0 beta1, 1.1.3 beta1, 1.1.2, trunk
SVN Range
AppliesTo Engine
Component FoswikiRender
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:a2cfc64446a7 distro:063a045bab45
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches master
trunkCheckins
masterCheckins distro:a2cfc64446a7 distro:063a045bab45
ItemBranchCheckins
Release01x01Checkins
Topic revision: r8 - 05 Jul 2015, GeorgeClark - This page was cached on 09 Dec 2016 - 05:17.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License