Universal escaping
nav_first.pngFirst: thread:131
HTML Block
Edited: 11 Oct 2012 12:06 by: GoVegan
Comments: 0
nav_prev.pngPrevious: thread:130
Private Categories
Edited: 15 Jan 2010 01:28 by: leiger
Comments: 3
Last: thread:112
Image Module
Edited: 12 Nov 2009 12:22 by: pieterh
Comments: 0
Next: thread:235
Avatar Module
Edited: 11 Jan 2010 07:30 by: pieterh
Comments: 0

GabrysGabrys wrote on 30 Dec 2009 13:51

Purpose: the purpose of universal escaping is ability to display ANY text in browser. Now it's almost possible using @@, but you can't easily put @@ inside of such text. You can put almost any text inside of [[code]] block, but you can't put there [[/code]] and so…

The proposed solution is to introduce two new syntax entities: @< and >@. Between them you can put any text provided you first:

  • convert each "&" to "&amp;"
  • convert each "<" to "&lt;"
  • convert each ">" to "&gt;"

(this is also known as HTML escaping).

This will work for single lines only. This means if you have a block of a few lines to escape, you need to escape each line in the block separately.

Using this technique, you can put ANY text on your site, for example:

| What you want:            | What you write to get it:  |
| code @@ example           | @<code @@ example>@        |
| @@code example@@          | @<@@code example@@>@       |
| @<code example>@          | @<@&lt;code example&gt;@>@ |

You can also put so called HTML entities (including all UTF-8 characters) inside of "@<" and ">@", like "&copy;", to get the copyright sign ("©") without searching for it in a char table or in the Internet.

Live example:

@<U umlaut: &#252;>@
@<Hello world @@ !!!!>@
@<Something **not** bold>@
@<[[module ListPages]]>@
@<Copyright sign: &copy;>@
Works @<inline as>@ well
This way you can escape universal escaping tokens: @<@&lt;>@ and @<&gt;@>@

In action:

U umlaut: ü
Hello world @@ !!!!
Something **not** bold
[[module ListPages]]
Copyright sign: ©
Works inline as well
This way you can escape universal escaping tokens: @< and >@

Start a new sub-thread

Comments: 3

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License