ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* hyphenation of urls in french docs
@ 2006-07-12 15:02 Taco Hoekwater
  2006-07-12 16:36 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Taco Hoekwater @ 2006-07-12 15:02 UTC (permalink / raw)


Hi (mostly for Hans),

Is there a clean way to get around this problem:

   \useencoding[ffr]
   \mainlanguage[fr]
   \starttext
   \hyphenatedurl{http://somewhere.to/go}
   \stoptext

It gives:

   ! Undefined control sequence.
       <argument> \discretionarytoken

because of the active : , but I am not sure what
is the best fix.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: hyphenation of urls in french docs
  2006-07-12 15:02 hyphenation of urls in french docs Taco Hoekwater
@ 2006-07-12 16:36 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2006-07-12 16:36 UTC (permalink / raw)


Taco Hoekwater wrote:
> Hi (mostly for Hans),
>
> Is there a clean way to get around this problem:
>
>    \useencoding[ffr]
>    \mainlanguage[fr]
>    \starttext
>    \hyphenatedurl{http://somewhere.to/go}
>    \stoptext
>
> It gives:
>
>    ! Undefined control sequence.
>        <argument> \discretionarytoken
>
> because of the active : , but I am not sure what
> is the best fix.
>   
\expandafter\if\string#1 etc 


\def\scanurl#1%
  {\advance\scratchcounter\plusone
   \ifx#1\blankspace
     \flushurl\splitanyway\normalspace
   \else\ifx#1\ %
     \flushurl\splitanyway\normalspace
   \else\ifx#1\space
     \flushurl\splitanyway\normalspace
   \else\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\expandafter\if\string#1\lettertilde
     \flushurl\splitbefore\~%
   \else\expandafter\if\string#1\letterpercent
     \flushurl\splitbefore\%%
   \else\expandafter\if\string#1\letterunderscore
     \flushurl\splitbefore\_%
   \else\expandafter\if\string#1\letterquestionmark
     \flushurl\splitafter\letterquestionmark
   \else\expandafter\if\string#1\letterat
     \flushurl\splitafter\letterat
   \else\expandafter\if\string#1\letterslash
     \edef\savedurl{\savedurl\letterslash}%
   \else\expandafter\if\string#1+%
     \flushurl\splitafter+%
   \else\expandafter\if\string#1:%
     \flushurl\splitafter:%
   \else\expandafter\if\string#1.%
     \flushurl\splitafter.%
   \else\expandafter\if\string#1(%
     \flushurl\splitbefore(%
   \else\expandafter\if\string#1)%
     \flushurl\splitafter)%
   \else
     \ifx\savedurl\empty\else
       \splitbefore\savedurl
       \let\savedurl\empty
     \fi
     \ifcase\urlhyphenmethod
       \string#1%
     \else
       \ifnum\scratchcounter>\plusthree % so, \http: will not break
         \edef\savedurl{\string#1}%
       \else
         \string#1%
       \fi
     \fi
   \fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-12 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-12 15:02 hyphenation of urls in french docs Taco Hoekwater
2006-07-12 16:36 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).