stale_content2Add my vote for this tag create new tag
, view all tags

Implemented: Use exclamation point to escape TWikiML rendering

TWikiVariables and TWikiML rendering can be escaped by prefixing a variable or a word with an exclamation point, e.g. !EscapedWord renders as EscapedWord, !%MAINWEB% renders as %MAINWEB%. This replaces the existing <nop> tag rule, which gets deprecated but remains implemented.


You type You get Comment
WebNotify WebNotify link as usual
Main.WebNotify WebNotify link as usual
<nop>WebNotify WebNotify escaped with nop
!WebNotify WebNotify escaped with exclamation point
(!WebNotify) (WebNotify) escaped with exclamation point
{!WebNotify} {!WebNotify} not escaped, WikiWord must be preceeded by space or parenthesis
[[WebNotify]] WebNotify normal double square link
![[WebNotify]] [[WebNotify]] escaped
!Main.WebNotify Main.WebNotify escaped with exclamation point
peter@thoeny.com peter@thoenyPLEASENOSPAM.com link as usual
mailto:peter@thoeny.com mailto:peter@thoenyPLEASENOSPAM.com link as usual
!peter@thoeny.com peter@thoeny.com escaped with exclamation point
!mailto:peter@thoeny.com mailto:peter@thoeny.com escaped with exclamation point
http:/twiki.org/ http:/twiki.org/ link as usual
!http:/twiki.org/ http:/twiki.org/ escaped with exclamation point
!foo and bar! with aaa!bbb foo and bar! with aaa!bbb tests exclamation points at various locations
foo ! bar foo ! bar standalone exclamation
This is *bold*, _italic_,
  __bold italic__, =fixed= escaped
This is bold, italic,
bold italic, fixed escaped
rendered as usual
This is !*bold*, !_italic_,
  !__bold italic__, !=fixed= escaped
This is *bold*, _italic_,
__bold italic__, =fixed= escaped
%MAINWEB% Main expanded variable
!%MAINWEB% %MAINWEB% escaped variable

TWiki.WikiWord escaped at the beginning of the line

%MAINWEB% variable escaped at the beginning of the line

-- MattWilkie - 22 Oct 2003, 03 Jan 2004
-- ArthurClemens - 22 Oct 2003
-- PeterMasiar - 22 Oct 2003
-- PeterThoeny - 22 Mar 2004


We would like to be able to replace or supplement the existing <nop> operator with an alternate syntax which is easier to type and read.

Option 1: use single quotes ('). 'This_is_not_a_wiki_word' and 'NeitherIsThis' nor '%VARIABLE%' for instance.

Option 2: use the backquote (`). Example: `<xmlobject class="example">` without resorting to having to write &gt; for a greater than bracket (>).

Option 3: use an exclamation mark: some_programming_procedure. Logical for links (well, for programmers) but less so for brackets.

Option 4: use sqare brackets ]]foo[[

Option 5: use <> instead of <nop>: <>ThisIsNotAWikiWord. Logical for TWikiers

Option 6: use tidle (~). Example ~some_programming_procedure.

At present only options 3 & 6 are being considered. See voting at bottom of this topic.

-- MattWilkie - 22 Oct 2003, 03 Jan 2004
-- ArthurClemens - 22 Oct 2003
-- PeterMasiar - 22 Oct 2003


Please enter your preference below by adding one digit. Vote count will be at 15 March 2004.

Char Vote count
! 7
~ 3
Neither 2


I think single quote makes the most sense. we should move away from programmer syntax, and backquote always puzzles me (especially when using a dumb font that has one pixel difference between backquote and singlequote. I am not fond of the square brackets, but - what do other wiki's use?

-- SvenDowideit - 03 Jan 2004

I also think the single quotes would be the most obvious for users. but I checked, I already have 688 places in my main TWiki site where the 'foo' syntax is already used by users, so I am afraid this syntax is "too natural" to be used without conflicts.

-- ColasNahaboo - 05 Jan 2004

I put in a vote for option 3 because it: 1) requires the least number of keystrokes, 2) does not involve bracketing anything (which I find inherently bothersome and would like to remove elsewhere in TWikiML), 3) seems intuitive (to me at least) to add a single character that negates what immediately follows, and 4) has at least partial precedence in format for not including a heading in TOC (e.g. "---+!!").

-- LynnwoodBrown - 05 Jan 2004

I would suggest the tilde character, which could work in both the Wiki word and TOC cases. This is also consistant with phpwiki wrt excluding a Wiki word.

-- PaulWarwicker - 06 Jan 2004

Ah yes, but how many of those 688 single quotes are used in a manner which means something other than "this is verbatim"? E.g. how many contain wiki words and variables? I wager not many, if any. On our site every occurence of single quote usage I looked at was already being used in a manner consistent with what is being asked for here.

In the end I prefer single quotes, but would be satisfied with tilde.

-- MattWilkie - 06 Jan 2004

I can't quite decide if I prefer tilde or single quotes. I just know that users of the TWiki I manage would appreciate not having to <nop> any longer. Because neither me nor the users could keep in mind where to correctly place the <nop> with WikiWord or %VARIABLES%, I had to put a reminder in the syntax-help-table that our skin has next to the edit-box.

-- PatrickHansmeier - 20 Jan 2004

I love the idea of simplifying nop, but both tilde and single quotes have conventional meanings in the written language: "approximately" and "a quoted statement" respectively. Tilde would be a clear preference for me, as 'SingleQuotes are common' in the written language. Please be very careful to only eat the tilde if it is followed by a wikiword. The following sentence should read as written: "There are ~ten 'HolyCommandments' but only ~9 'circles' of hell".

-- CrawfordCurrie - 21 Jan 2004

Important points Crawford. However wikiwords aren't the only things we need to nop. Essentially a nop is an inline verbatim minus the fixed width text styling. It looks like we can't escape using a multiple delimiter, eg.

this is a single nop'd ```WikiWord and so is this ```%TOPIC% while emphasis still works

```this is an inline verbatim, no WikiWords and no %VARIABLES% or *strong* _emphasized_ text```

but how does the code know the difference between these two?

the first is "whitespace, ```, alphanumeric character";
the second is "alphanumeric character, ```, whitespace".

would this work?

-- MattWilkie - 21 Jan 2004

I'd like to bring up the possibility again of using a single exclamation mark prior to the WikiWord or variable. Does anyone see a comflict with common conventions or other syntax? Also, it gets away from the bracketing, which is a significant plus from a general users perspective, IMHO.

-- LynnwoodBrown - 21 Jan 2004

Matt, I couldn't get my head round your example the first time I read it, and if I can't, then it's probably too complicated for a casual user.

ieee, that's no good!

I'd say if you want to nop variables, use <nop>; if you want to escape a WikiWord, use ~WikiWord or Wiki<nop>Word i.e. ~ is just a shortcut for <nop> in paragraph text. KISS. The rule should be something like "if you wee a wikiword that you would normally link, check to see if it's preceded by a ~ and if it is, eat the ~ and don't expand the wikiword". So:

~~WikiWord should render as ~WikiWord
_~WikiWord_ should render as <em>WikiWord</em>
etc. I think this is relatively easy to do in getRenderedVersion; I made it work by putting:
immediately after the # 'TopicName' link: regex.

-- CrawfordCurrie - 22 Jan 2004

Now that I see it, ~NotaWikiWord is easier, both to type and to read while editing. Why not just do the same for ~%VARAIBLE%? (I nop variables more often than wikiwords.)

>immediately after the # 'TopicName' link: regex.

Sorry I need more handholding than that smile I can't find the spot you are refering to (current alpha)

-- MattWilkie - 22 Jan 2004

But Matt - you are just extraordinary. Most punters never use variables, and certainly don't escape them.

I'm selfish. I want twiki to be easy for me ; ) (as long as it doesn't come at the expense of "the punters" anyway)

But I suppose you could say "%~VARIABLE%" for a measure of consistency, and use the rule "% followed by ~ followed by an uppercase word is %<nop>word". This would have to beat the plugins to the punch, so would have to be before the first hook; something like

$text =~ s/(\s%)~([A-Z]+[\{%]/$1<nop>$2/go;
should do the business.

To find the spot, look at getRenderedVersion, find the end of the loop over the split(/\n/), and scroll slowly up, reading carefully. I'd be surprised if it wasn't in the current alpha (I haven't looked).


-- CrawfordCurrie - 23 Jan 2004

The tilde char is a good candidate for a new TWikiML rule, like for example a StrikeThroughShortHand or possibly UnderlineShortHand. So I would prefer to use a different char to escape WikiWord linking.

If I put on my programmer's hat I'd vote for the exclamation point, for the same reasons Lynnwood Brown pointed out.

-- PeterThoeny - 27 Jan 2004

All the arguments LynnwoodBrown made for the exclamation point, with the exception of (4) which I think is not a very strong precedence as he already pointed out, also apply to the tilde character. In addition, a tilde is more readable. Compare:

  • ~WikiWord
  • !WikiWord

I realize that tilde is also considered for strikeout, which I believe is much less common, and should end up with the less readable variant. (By "readable", I refer to the raw text.)

-- ThomasWeigert - 27 Jan 2004

For Crawford's ~WikiWord suggestion, I found the spot near line 2955 in the # Make internal links section. The format of the command has changed a little (I used # 'TopicName' link: as a pattern template):


I couldn't get his other suggestion to work. For one there is an unmatched brace in his example, which causes TWiki.pm to not be found. Aside from that though, putting anything in front of the first plugin hook (at # Wiki Plugin Hook near line 2797) made everything really, really slow (and didn't work anyway). I guess this is the wrong place or maybe I matched the brace incorrectly. update: the hangup may have been due to TWikiOnApache2dot0Hangs

Anyway, for variables I have decided the simpler approach is to just use lower case or embed a space: %puburl% and % PUBURLPATH%.

a couple of comments inline in CC's 23-Jan post

As for which character to use, either of ~ or ! work for me.

-- MattWilkie - 23 Feb 2004

I can't really decide between ! and ~ (but I did below...). In everyday use, nop would be used most for TWikiTopics, but I feel TWiki should move away from CamelCase towards free linking, like [[Page name]]. Nopping then becomes useful for variables only, and can be considered a power user (programmer's) feature. I think ! and ~ are equally untuitive, but equally harmless.

Voting table moved to bottom.

-- ArthurClemens - 28 Feb 2004

Offtopic discussion on the wiki-ness of nop

on thinking about it - the use of < nop> stops wiki-ness

  • think of it like this - if another user creates a page from ThisIsALink, and you wrote ~ThisIsALink, you've just stuffed them up, because you designed a limitation into yout topic text.

so maybe < nop> should not be easy anyway. um - where's the justification for this feature anyway?

good things should be easy, but bad things (non-wiki ones) should be made more difficult (not impossible though)

Why? I happens a lot that proper names are written in CamelCase, like Macromedia ActionScript, or a function name AsBroadcaster. It is easier to read if you nop them: ActionScript, AsBroadcaster. In fact it is bad writing manner to stuff the text with links. If you use a topic link once in a paragraph that is enough to serve its function, more makes a bad to read text.

If someone disables the link to a page, well, there are always other ways to retrieve the page. or of enabling the link

-- ArthurClemens - 01 Mar 2004

um, you are not actually right here, sorry

in a wiki it is polite and reasonable to expect Proper names to be in CamelCase, and for those words to be linked.

you should always remember that twiki is a wiki. if you want to get rid of the ? after words, or link only once in a paragraph, thats a plugin that you can write (or have written :).

-- SvenDowideit - 01 Mar 2004

Not sure whether there is such a religion... smile

-- ThomasWeigert - 01 Mar 2004

Sven, you can't assume this. There are a lot of reasons to use a wiki. Sometimes I use TWiki in a way that it doesn't look like a wiki at all, perhaps more as a website. But usability rules (and common sense) also apply to wikis, not only to wikis.

If you take your argument to the extreme, then you can also condider that variables are not wiki-like. I am sure you don't want to go that far.

-- ArthurClemens - 01 Mar 2004

Sometimes it's not till the 3rd or 4th time I see a WikiWord that I decide I'm interested in it. The fact that they are all linked and have the same words stuck together reinforces that they are linking to the same thing. When I decide I'm interested in something I don't want to have to go looking for a link to it, or move my hand from the mouse to the keyboard. And if the first mention of a topic is in the middle of a discussion and I start reading after that point, or skim past it, I might never realise there is a page already created that expands on the discussion.

-- SamHasler - 01 Mar 2004

If the default UncreatedTopic LinkStyle were LessObtrusive, it would release pressure for nopping WikiWords.

The need to nop variables remains, for which a relatively simple workaround is easily to add a space or lowercase some of the var-name.

The remaining nop need is for escaping html tags without resorting to verbatim or cumbersome &lt; syntax.

(did I miss any use cases?)

It thought it would be interesting to count the number of <nop> occurences in a standard twiki release: in the last beta nop is used 643 times in 226 topics. A pretty clear demonstration of need I think.

-- MattWilkie - 01 Mar 2004

hey Matt, do you think 643 times is a big enough number to make nop simpler and more common?


(i think having a plugin that changes the rendering of UncreatedTopic LinkStyle would be a better solution.

yes, but it only addresses a single use case (which isn't an argument against doing so, I think it should be done regardless of what is decided here)

-- SvenDowideit - 02 Mar 2004, -- MattWilkie - 02 Mar 2004

I was thinking about saving ~ to replace space in filenames when we decide to get rid of CamelCase and use space as word separator in pagenames. And I've seen and liked ]]CamelCase[[ as way to prevent creating hyperlink.

Kind of opposite of [[link]]

-- PeterMasiar - 02 Mar 2004

Why not replace spaces in topic names by underscores, as Wikipedia? That makes the url actually readable in the browser address bar. See also TopicSaveErrorWithTopicsContainingSpace.

-- ArthurClemens - 02 Mar 2004


-- CrawfordCurrie - 02 Mar 2004

No, no no! [[This is a topic title]]. Just type the spaces. The file becomes This_is_a_topic_title.txt.

-- ArthurClemens - 02 Mar 2004

A couple of comments inline above. Isn't the underscore/spaces thread in the wrong topic?

I just rediscoverd a nop that already exists: 'NotAWikiWord' ;only works for WikiWords.

-- MattWilkie - 02 Mar 2004

Yes, except that the quotes are still visible. Not always useful.

-- ArthurClemens - 02 Mar 2004

Arthur, I was also for using undescore - then I wanted to create a page names as program, which has underscore in name. Will be nice if any (most) special characters, which are widely used by programmers, was available in page name. Names like V1.1_beta are meaningfull, and making it V1dot1 is just awfull, IMHO.

-- PeterMasiar - 03 Mar 2004

Looking at the vote, the clear winner is the exclamation point rule.

This is now implemented, in TWikiAlphaRelease and at TWiki.org. TextFormattingRules is updated.

The current implemenation is for TWikiML rendering, but excludes variables and double square bracket links. For consistency this could/should be done as well:

You type You get Comment
[[WebNotify]] WebNotify link as usual
![[WebNotify]] WebNotify escaped
%WEB% Codev variable expanded as usual
!%WEB% %WEB% escaped
%CALC{test}% test variable expanded as usual
!%CALC{test}% %CALC{test}% escaped


-- PeterThoeny - 22 Mar 2004

Why bother? it already works if you put the ! inside.....

You type You get Comment
[[WebNotify]] WebNotify link as usual
[![WebNotify]] [![WebNotify]] escaped
%WEB% Codev variable expanded as usual
%!WEB% %!WEB% escaped
%CALC{test}% test variable expanded as usual
%!CALC{test}% %!CALC{test}% escaped

  • No, it does not since the ! escape works only if preceeded by whitespace or parenthesis. -- PTh - 22 Mar 2004

-- CrawfordCurrie - 22 Mar 2004

If you were seaching for %CALC{test}% would you also want the escaped ones found by the seach? The former syntax returns these automaticaly, while with the latter you would need a regex to also find escaped instances. On the other hand if you didn't want the escaped instances the situation is reversed. Which situation would you want by default, and which has the tidiest way of filtering in/out the escaped instances?

  • Not sure I understand this. Search is based on the raw topic text, without any variable expansion (the expandvariables="on" switch is only used to format the output after the variable expansion) -- PTh - 22 Mar 2004
  • I was contrasting the implemented syntax with Crawford's proposal, and how they would be found by search regex's (not the output format or patterns) if you wanted to search for them. I've reworded slightly to make this clearer. -- SH

-- SamHasler - 22 Mar 2004

Thank you very much implementing this!

I prefer prepending ! rather than embedding it. It's easier to think about and add/remove -- in my opinion.

That said, *bold* fails while _italic_ is okay (the exclamation should not be displayed).

-- MattWilkie - 22 Mar 2004

Agreed, Matt, consistent rules are always good, therefore !%WEB% is better then %!WEB% or %<nop>WEB%. Unlike TWikiML, variables do not depend on the prefix. That is, the ! rule needs to work also for these and other cases: web="!%WEB%", foo=bar&web=!%WEB%, any prefix !%WEB%.

This should be no problem, except where you need an exclamation point preceeding a variable. The only situation I can think of is in a regular expression NOT search, e.g. "this AND that BUT NOT %TOPIC%" expressed as "this;that;!%TOPIC%".

-- PeterThoeny - 22 Mar 2004

OK, I implemented the same rule now also for variables and double square bracket links. Please report here in case you find any issues.

Change is in TWikiAlphaRelease and at TWiki.org.

-- PeterThoeny - 25 Mar 2004

*bold* and =fixed= are still broken: the escaping works, but the shebang is displayed. Should be like: _italic_

!*bold* and !=fixed= are still broken: the escaping works, 
but the shebang is displayed. Should be like: !_italic_

-- MattWilkie - 26 Mar 2004

The escaping of *bold* and =fixed= is fixed since yesterday, see tests on top.

I intruduced an incompatibility with the !%VARIABLE% escaping rule which needs to be fixed. Example:

| %RED%Lasciate ogni speranza, voi ch'entrate!%ENDCOLOR% |
renders as:
Lasciate ogni speranza, voi ch'entrate%ENDCOLOR%

The %ENDCOLOR% incorrectly gets escaped because of the punctuation in the sentence. This is a common case. Possible fixes:

  1. Change variable escaping rule to %!VARIABLE% as Crawford suggests
    • smile existing users find this obvious
    • frown not consistent with TWikiML escaping (confusing new users)
  2. Require a leading space-bang or parenthesis-bang to escape a variable, e.g. This !%VARIABLE% is escaped; this not!%VARIABLE%
    • smile consistent with TWikiML escaping
    • frown can't always escape variables, e.g. if you want to show how to escape web="!%WEB%"

Notice that there is no change in spec of existing <nop>, just undocumented.


-- PeterThoeny - 25 Mar 2004

  1. New users are unlikely to be using %VARIBLE%, which on balance is probably a lot more confusing. This escape is likely to be used only by TWiki masters.
  2. Leading space is orthogonal to the way variable expansion works in general.

-- CrawfordCurrie - 26 Mar 2004

OK, I changed the spec to require a leading space & bang to escape TWikiML, variables and double square bracket links.

Change is in TWikiAlphaRelease and TWiki.org.

-- PeterThoeny - 25 Mar 2004

In TWikiVariables is the exclamation point in the text "!TWikiVariables are text strings - !%VARIABLE% - that expand ..." supposed to be there, has it been put in the raw text incorrectly or is it showing incorrectly in the viewed topic?

-- SamHasler - 31 Mar 2004

Thanks for catching that. Text is updated.

-- PeterThoeny - 01 Apr 2004

I note that in CairoRelease there are some formatting tricks that can only be done with <nop> and not with the exclamation mark. In other words, the exclamation mark is not (yet?) a functional replacement for <nop>. For example, compare !MyJavaClass and MyJavaClass. See also TocShowsExclamationMarkBeforeEscapedWikiWord. I hope these differences will be ironed out before the deprecated <nop> tag is removed altogether!

-- JamesAnderson - 07 Apr 2005

Edit | Attach | Watch | Print version | History: r68 < r67 < r66 < r65 < r64 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r68 - 2006-10-02 - JadeCravy
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.