From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/14627 Path: main.gmane.org!not-for-mail From: Willi Egger Newsgroups: gmane.comp.tex.context Subject: Re: Hyphenation of URLs with and without interaction Date: Mon, 26 Jan 2004 13:20:10 +0100 Sender: ntg-context-admin@ntg.nl Message-ID: <401505FA.1090000@boede.nl> References: <20040123105933.GA15024@physik.fu-berlin.de> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1075119707 27165 80.91.224.253 (26 Jan 2004 12:21:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2004 12:21:47 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Mon Jan 26 13:21:39 2004 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Al5kJ-0005Ip-00 for ; Mon, 26 Jan 2004 13:21:39 +0100 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id 598B210B33; Mon, 26 Jan 2004 13:20:32 +0100 (MET) Original-Received: from smtp-out1.xs4all.nl (smtp-out1.xs4all.nl [194.109.24.11]) by ref.ntg.nl (Postfix) with ESMTP id 3034B10B24 for ; Mon, 26 Jan 2004 13:19:18 +0100 (MET) Original-Received: from boede.nl (a80-126-172-1.adsl.xs4all.nl [80.126.172.1]) by smtp-out1.xs4all.nl (8.12.10/8.12.10) with ESMTP id i0QCKFnS027562 for ; Mon, 26 Jan 2004 13:20:21 +0100 (CET) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en Original-To: ntg-context@ntg.nl In-Reply-To: <20040123105933.GA15024@physik.fu-berlin.de> Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: ntg-context@ntg.nl List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:14627 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:14627 Hello Mathias, your question forwarded by Tobias Burnus has been discussd a couple of days ago on this list. I send you the reply given by Hans Hagen: 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 _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context