Re: [NTG-context] modifying URL wrapping rules

On 11/19/2008 2:35 PM, Lars Huttar wrote:
> 2) Even though I have "\sethyphenatedurlafter /" instead of
> "\sethyphenatedurlbefore /", there are four cases where a URL is broken
> before a slash, e.g.:
> http://www.sil.org/.../009
> /YAMBASSA.html.
> and no cases where a URL is broken after a slash (except when it's also
> before a slash -- see 1).
>
> I wonder if my modifications are actually taking effect?
> Do I need to compile the changes to the .mkii file or something? I tried
> texexec.bat --make --all, but that didn't seem to change the outcome.

Can someone tell me if there's a compile command necessary for mkii?

> 3) Conversely, even though I have "\sethyphenatedurlbefore -" and not
> "\sethyphenatedurlafter -", there is a case where a URL is broken after
> a hyphen (a hyphen that was already present in the URL):
> http://www..../Niger-
> Congo/...
> and no case where a URL is broken before a hyphen.
> Note that the "\sethyphenatedurlbefore -" setting is unchanged from the
> original lang-url.mkii, so this is not an issue of needing to recompile.
>
> Maybe the general tex hyphenation mechanism is operating here, in spite
> of the URL breaking settings. How do I override that (only for the URL)?

Maybe it would help if someone could explain to me what 'normal' means
in lang-url.mkii:

\def\dohyphenatedurlnormal#1{\char#1\relax}%
\def\dohyphenatedurlafter
#1{\char#1\discretionary{}{\hyphenatedurlseparator}{}}%
\def\dohyphenatedurlbefore#1{\discretionary{\hyphenatedurlseparator}{}{}\char#1\relax}%

% 0=normal 1=before 2=after

\def\sethyphenatedurlnormal#1{\expandafter\chardef\csname url @
#1\endcsname\zerocount}
\def\sethyphenatedurlbefore#1{\expandafter\chardef\csname url @
#1\endcsname\plusone  }
\def\sethyphenatedurlafter #1{\expandafter\chardef\csname url @
#1\endcsname\plustwo  }

It looks like 'normal' means don't put a discretionary
hyphenatedurlseparator before/after the character. Which would mean
either (a) the url cannot be separated there (unless an adjacent
character has hyphenatedurlbefore/after specified on it); or (b) the url
will follow the same hyphenation rules as normal text (no special
url-related rules). Can anyone tell me which it is? The definition of
hyphenatedurl is:

\unexpanded \def\hyphenatedurl#1%
{\dontleavehmode
\begingroup
\the\everyhyphenatedurl
\edef\ascii{#1}%

\expanded{\handletokens{\detokenize\expandafter{\ascii}}}\with\dohyphenatedurl
\endgroup}

and the definition of \dontleavehmode is in syst-ext.tex with some comments:

%D \macros
%D  {dontleavehmode}
%D
%D Sometimes when we enter a paragraph with some command, the
%D first token gets the whole first line. We can prevent this
%D by saying:
%D
%D \starttyping
%D \dontleavehmode
%D \stoptyping
...
\unexpanded \def\dontleavehmode
{\ifhmode\else \ifmmode\else
\setbox\@@dlhbox\hbox{\mathsurround\zeropoint\everymath\emptytoks}\unhbox\@@dlhbox
\fi \fi}
...
%D But, if you run a recent version of \TEX, we can use the new
%D primitive:

\ifx\normalquitvmode\undefined \else \let\dontleavehmode\normalquitvmode \fi

I am running Xetex, FWIW.
"This is XeTeX, Version 3.1415926-2.2-0.999.6 (Web2C 7.5.7)"

The above makes me think that "dontleavehmode" should prevent any
'hyphenation' except for the types explicitly allowed in lang-url.mkii
via \sethyphenatedurlafter/before/normal.

Yet that isn't happening... it's breaking before slash instead of after,
and after hyphen instead of before.

I wondered briefly whether I had misinterpreted (swapped) the semantics
of \sethyphenatedurlafter and \sethyphenatedurlbefore. But no,
"\sethyphenatedurlbefore ." is working as expected: URLs break before a
period. So I'm just puzzled.

Thanks for any help...

Lars

___________________________________________________________________________________