ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: hyphenation of urls in french docs
Date: Wed, 12 Jul 2006 18:36:15 +0200	[thread overview]
Message-ID: <44B524FF.6050202@wxs.nl> (raw)
In-Reply-To: <44B50F12.3080504@elvenkind.com>

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
-----------------------------------------------------------------

      reply	other threads:[~2006-07-12 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-12 15:02 Taco Hoekwater
2006-07-12 16:36 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44B524FF.6050202@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).