# [NTG-context] Custom breakpoints for \hyphenatedurl

Joshua Krämer joshua.kraemer at gmail.com
Thu Aug 7 15:14:07 CEST 2014

On 2014-08-07, 12:58, Wolfgang Schuster wrote:

> The position of the \hyphenatedurlseparator symbol depends currently
> on the breakpoint in the url, when the break is allowed after a
> character at the end of line but when the break is allowed before a
> character the symbol appears at the begin of the line.
> The question is now if this is intended or can it be changed.

I can hardly imagine this to be intended.  The reader should be
informed about a break as soon as he reaches the break, so he knows the
word/token is not finished yet.  As we read from top to bottom, the
end of the top line is where this information should be.

> Another thing where we can discuss is the way to set the separator,
> e.g. \sethypehantedurlseparator{…} seems more appropriate than
> \def\hyphenatedurlseparator{…} because we already have other \setXXX
> commands.

Agreed.

> > The second URL has a linebreak in front of the colon, which I do
> > not want.
>
> The points where contexts is allowed to break a url at :/# etc. are
> predefined in the Lua code.
>
> When you want to change this you have to use the three commands
>
>   - \sethyphenatedurlbefore{…}
>   - \sethyphenatedurlafter{…}
>   - \sethyphenatedurlnormal{…}

Could you please change my minimal example (attached at the
end) accordingly? I want an URL like "http://optimist" to be wrapped
after "://" only, not in front of the colon.  I couldn't find out how to
achieve this.  I also want no linebreak to occur between two slahes
(if this is possible with the current implementation).  By the way, I
also don't understand the meaning of \sethyphenatedurlnormal {...}.

Kind regards,
Joshua

\setuplayout[width=5cm]
\sethyphenatedurlafter {/}
\sethyphenatedurlbefore {}
\sethyphenatedurlnormal {}
\starttext

Word Word Word \hyphenatedurl {http://optimist.optimist}

Word Word Word W \hyphenatedurl {http://optimist.optimist}

Word Word Word Wo \hyphenatedurl {http://optimist.optimist}

(Only the first of these three linebreaks is desired.)

\stoptext