[NTG-context] hyphenated url

Aditya Mahajan adityam at umich.edu
Sun Oct 31 07:06:58 CET 2010


On Mon, 25 Oct 2010, Steffen Wolfrum wrote:

> Hi,
>
> the "%" is a frequently used character in URL.
> But \hyphenatedurl{} can deal with it ...
>
> Does someone has a fix?
>
>
> \starttext
> text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
> \stoptext

This is more a proof of concept so I did not take care of the optional 
argument of \footnote.

\newcatcodetable \mytxtcatcodes
\startcatcodetable \mytxtcatcodes
     \catcode`\^^I = 10
     \catcode`\^^M =  5
     \catcode`\^^L =  5
     \catcode`\    = 10
     \catcode`\^^Z =  9
     \catcode`\\   =  0
     \catcode`\{   =  1
     \catcode`\}   =  2
\stopcatcodetable

\def\dosingleasciigroup#1%
   {\pushcatcodetable
    \setcatcodetable \mytxtcatcodes
    \def\next##1{#1{##1}\popcatcodetable}%
    \next}

\def\setasciicommand#1%
   {\savenormalmeaning{#1}%
    \def#1{\dosingleasciigroup{\csname normal\strippedcsname#1\endcsname}}}

\setasciicommand\footnote
\setasciicommand\hyphenatedurl

\starttext
\hyphenatedurl{http://www.google.com/some%20thing}
test \footnote{A footnote with a \bold{url} 
\hyphenatedurl{http://www.google.com/some%20thing}}

\stoptext


Aditya


More information about the ntg-context mailing list