Changes

Jump to navigation Jump to search
1,568 bytes removed ,  13:26, 9 August 2020
m
Text replacement - "</cmd>" to "}}"
URLs can be typeset in various ways. You may specify a URL for later reuse via {{cmd|useURL}}:
<texcode>
\useURL[aurl] [http://xkcd.com/149/] [] [I prefer hot dogs.]
</texcode>
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
=== Example for Mailto #1 ===
<context source=yes>
\setupinteraction[state=start]
\useurl [mymail] [mailto:nobody@example.zzz] [][visible@mailaddress.zzz]
\starttext
Send your spam to \from[mymail]!  \stoptext
</context>
<context source=yes>
\setupinteraction[state=start] \starttext Send your spam to \goto{visible@mailaddress.zzz}[url(mailto:nobody@example.zzz)] \stoptext
</context>
<context source=yes>
\setupinteraction[state=start] \useurl [myurl] [www.example.zzz/\#999] [][www.example.zzz/\#999]
</context>
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}
\unexpanded\def\mypersonalurl#1{%
\bgroup\tt\goto{\hyphenatedurl{#1}}[url(#1)]\egroup}
\starttext \startasciimode \mypersonalurl{http://a.b?hpw%20h#pw} \stopasciimode \startasciimode \footnote{\mypersonalurl{http://a.b?hpw%20h#pw}} \stopasciimode \placenotes[footnote]\stoptext
</context>
But you have to consider one option to make it work:
* Setting <{{cmd>|asciimode</cmd> }} 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>}}...<{{cmd>|stopasciimode</cmd>}}.<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 ===
\stoptext
</pre>
 
[[Category:Basics]]
[[Category:Interaction]]

Navigation menu