Jump to navigation Jump to search
1,575 bytes added ,  13:26, 9 August 2020
Text replacement - "</cmd>" to "}}"
URLs can be typeset in various ways. You may specify a URL for later reuse via {{cmd|useURL}}:
\useURL[aurl] [] [] [I prefer hot dogs.]
where #1 is the identifier, #2 is the URL you want to point to, and #4 the text to be displayed where the URL is used. #3 can be used for the 'file path' portion of the URL, if you want. This dates back to when hyperlink support in
<!--You can use<texcode>\url[aurl]</texcode>as well, which behaves like {{cmd|from}}[#1].--> URL shortcuts defined by {{cmd|useURL}} can be used while {{cmd|url}} as well:
as well, which behaves like \from[#1].
== How to Typeset URLs ==
=== Example for Mailto #1 ===
<context source=yes>
\useurl [mymail] [mailto:nobody@example.zzz] [][visible@mailaddress.zzz]
Send your spam to \from[mymail]!
Send your spam to \stoptext from[mymail]!
<context source=yes>
\setupinteraction[state=start] \starttext Send your spam to \goto{visible@mailaddress.zzz}[url(mailto:nobody@example.zzz)] \stoptext
=== Escaping of Special Characters ===
You might be interested in [[URL#Avoid_Escaping_Characters|not escaping characters]]. Note that special characters, eg hash sign, percent sign, must be escapedby backslash.
Escaping means that the special character will be processed one step later and it prevents
annoying error messages during compilation.
The <code>#</code> sign will be replaced by <code>\#</code>,<br/>the <code>%</code> sign will be replaced by <code>\%</code>, etc.
<context source=yes>
\setupinteraction[state=start] \useurl [myurl] [www.example.zzz/\#999] [][www.example.zzz/\#999]
The method for escaping of special characters described above does not work with command
{{cmd|hyphenatedurl}}completely, unfortunately. Escaping backslash will undesirably appear on the outputwhen percent sign is printed out. Similar problems bring hash sign and backslash.
In this caseTherefore, all special these three characters must be rewritten to commands, see the following list:
<tr><td><code>%</code></td><td> --> <code>{{cmd|letterpercent}}</code></td></tr>
<tr><td><code>#</code></td><td> --> <code>{{cmd|letterhash}}</code></td></tr>
<tr><td><code>\</code></td><td> --> <code>{{cmd|letterescape}} or {{cmd|letterbackslash}}</code></td></tr>
For other characters, similar commands have been predefined but it is not necessary to use them.
<tr><td><code>&</code></td><td> --> <code>{{cmd|letterampersand}}</code></td></tr>
<tr><td><code><</code></td><td> --> <code>{{cmd|letterless}}</code></td></tr>
<tr><td><code>></code></td><td> --> <code>{{cmd|lettermore}}</code></td></tr>
<tr><td><code>"</code></td><td> --> <code>{{cmd|letterdoublequote}}</code></td></tr>
<tr><td><code>'</code></td><td> --> <code>{{cmd|lettersinglequote}}</code></td></tr>
<tr><td><code>$</code></td><td> --> <code>{{cmd|letterdollar}}</code></td></tr>
<tr><td><code>^</code></td><td> --> <code>{{cmd|letterhat}}</code></td></tr>
<tr><td><code>_</code></td><td> --> <code>{{cmd|letterunderscore}}</code></td></tr>
<tr><td><code>|</code></td><td> --> <code>{{cmd|letterbar}}</code></td></tr>
<tr><td><code>~</code></td><td> --> <code>{{cmd|lettertilde}}</code></td></tr>
<tr><td><code>/</code></td><td> --> <code>{{cmd|letterslash}}</code></td></tr>
<tr><td><code>?</code></td><td> --> <code>{{cmd|letterquestionmark}}</code></td></tr>
<tr><td><code>!</code></td><td> --> <code>{{cmd|letterexclamationmark}}</code></td></tr>
<tr><td><code>@</code></td><td> --> <code>{{cmd|letterat}}</code></td></tr>
<tr><td><code>:</code></td><td> --> <code>{{cmd|lettercolon}}</code></td></tr>
<tr><td><code>{</code></td><td> --> <code>{{cmd|letterbgroup}}</code> or <code>{{cmd|letteropenbrace}}</code> or <code>{{cmd|letterleftbrace}}</code></td></tr>
<tr><td><code>}</code></td><td> --> <code>{{cmd|letteregroup}}</code> or <code>{{cmd|letterclosebrace}}</code> or <code>{{cmd|letterrightbrace}}</code></td></tr>
For \{{cmd|goto }} and \{{cmd|from}}:
If you need many hyperrefs in your document these definitions may be handy for you
<context source=yes>
\def\href#1#2{\useURL[#2][{#2}][][{#1}]\goto{\url[#2]}[url(#1)]} \def\ahref#1{\color[linkcolor]{\ttx \href{#1}{<#1>}}} \def\fullahref#1{\color[linkcolor]{\ttx \href{#1}{http://#1}}} \def\mailto#1{\useURL[#1][mailto:#1][][#1]\from[{#1}]} \def\MailTo#1#2{\useURL[#1][mailto:#1][][#2]\from[{#1}]}
Send mail to \MailTo{foo@bar.zzz}{Mr. Foo}
=== Avoid Escaping Characters ===
In case you don’t want to escape characters from your URLs, you might want to use the following command:
<context source="yes">
\setupnotation[footnote][alternative=serried, numbercommand=\tfx]
But you have to consider one option to make it work:
* Setting {{cmd|asciimode}} for the whole document.<p>Comments won’t work, because <code>%</code> will be considered a standard character.</p>
* Wrapping all URLs inside {{cmd|startasciimode}}...{{cmd|stopasciimode}}.<p>If you use URLs inside footnotes, it is the whole footnote which has to be inside the pair of commands.</p><p>Comments inside the mode won’t work.</p>
=== External Links ===

Navigation menu