|
|||||
declaration/definition | escape | ||||
Related Syntax | Related Concepts |
Syntax
escape quoted-character
Allows a new character to be used to indicate a special character or a format item, rather than the normal "%". The use of escape
is deprecated in general, because it leads to non-standard OmniMark code that can be difficult to understand.
There can only be one escape declaration, which must come immediately after the translation type (and after declare heralded-names
, if any). If there is no translation type, and no declare heralded-names
, escape
must be the first declaration in the program.
Care should be taken in choosing the special character, in case it is misunderstood as something else by a reader.
As well, some characters are poor choices for the escape character because they prevent certain format items or characters from being entered. For example, if the apostrophe (" ' ") were the escape character, a string could not be bounded by apostrophes. The reason is that within the string apostrophes would be interpreted as escapes or, if doubled, as apostrophe characters, and there would be no way of ending a string.
The following code illustrates the use of the escape
declaration. Here it is used to designate the "#" as the escape character, replacing the default "%" symbol:
down-translate escape "#" translate "%" ; This would normally be "%%" local counter n set n to 3 output "#"#d(n)#"" ; This would normally be "%"%d(n)%""
Related Syntax declare heralded-names process |
Related Concepts Errors: the escape character Format items and the format operator |
---- |