At 11:59 23/01/2004, you wrote:
Hello,
If you run the test case below, once with and once without \statupinteraction[state=start], you realize that this influences the hyphenation.
Using interaction, the URL is only hyphenated at '/', '.' etc. Using no interaction, also the words are hyphenated.
How can I get also hyphenated words with interaction enabled?
----------------------------------------------------------- \showframe \setupinteraction[state=start] \def\gotoURL#1{\useURL[foo][#1]\goto{\url[foo]}[url(foo)]}
\starttext
\hskip5cm\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html}
\stoptext -----------------------------------------------------------
in context, hyphenation of interactive references is a rather tricky thing; this has to do with the fact that i want comfortable clickable areas. (another reason is that it should work with several backends. Some day i may offer an alternative solution (backend dependent). In the case of url's it's even more tricky since one cannot for instance use hyphenation patterns for it, so we have to rely on parsing. And, with parsing, we run into those catcode handling situations. When i have time, i'll rewrite the parser for etex (time is near that we drop tex in favor of etex) which is cleaner (but not entirely upward compatible). Now to your problem. Hyphenation is not done here and does not make sense either (mixed case) \bgroup \catcode`\~=\active \catcode`\/=\active \unexpanded\gdef\hyphenatedurl#1% {}{} handles accents {\bgroup \ifnum\hyphenpenalty<10000 \else \def\discretionary##1##2##3{##1\allowbreak##2}% \fi \obeyhyphens \def\splitbefore##1% {\setbox\scratchbox=\hbox{##1{}{}}% \ifcase\urlsplitmode \box\scratchbox \or \postwordbreak\box\scratchbox\prewordbreak \or \prewordbreak\discretionary{\box\scratchbox}{}{\box\scratchbox}\prewordbreak \else \postwordbreak\box\scratchbox\prewordbreak \fi}% \def\splitafter##1% {\ifcase\urlsplitmode ##1{}{}% \or \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak \or \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak \else \prewordbreak\discretionary{}{##1{}{}}{##1{}{}}\prewordbreak \fi}% \def\flushurl% {\savedurl\let\savedurl\empty}% \def\\% {\spliturl\#}% \let\~=\lettertilde\let~=\~% \let\/=\letterslash\let/=\/% \let\savedurl\empty \scratchcounter\zerocount \handletokens#1\with\scanurl\savedurl \egroup} \egroup \def\scanurl#1% {\advance\scratchcounter\plusone \ifx#1\~% \flushurl\splitbefore\~% \else\ifx#1\#% \flushurl\splitbefore\#% \else\ifx#1\&% \flushurl\splitbefore\&% \else\ifx#1\%% \flushurl\splitbefore\%% \else\ifx#1\_% \flushurl\splitbefore\_% \else\if\noexpand#1\relax #1% \else\ifnum\catcode`#1=8 \flushurl\splitbefore\_% \else\ifnum\catcode`#1=6 \flushurl\splitbefore\#% \else\ifnum\catcode`#1=4 \flushurl\splitbefore\&% \else\if#1\lettertilde \flushurl\splitbefore\~% \else\if#1\letterpercent \flushurl\splitbefore\%% \else\if#1\letterunderscore \flushurl\splitbefore\_% \else\if#1\letterquestionmark \flushurl\splitafter\letterquestionmark \else\if#1\letterat \flushurl\splitafter\letterat \else\if#1\letterslash \edef\savedurl{\savedurl\letterslash}% \else\if#1+% \flushurl\splitafter+% \else\if#1:% \flushurl\splitafter:% \else\if#1.% \flushurl\splitafter.% \else\if#1(% \flushurl\splitbefore(% \else\if#1)% \flushurl\splitafter)% \else \ifx\savedurl\empty\else \splitbefore\savedurl \let\savedurl\empty \fi \ifcase\urlhyphenmethod #1% \else \ifnum\scratchcounter>\plusthree % so, \http: will not break \edef\savedurl{#1}% \else #1% \fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} \chardef\urlhyphenmethod=0 \setupinteraction[state=start]\showframe \def\gotoURL#1{\useURL[foo][#1][#1]\goto{\url[foo]}[url(foo)]} \starttext \chardef\urlhyphenmethod=0 \hsize1pt\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html} \chardef\urlhyphenmethod=1 \hsize1pt\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html} \stoptext