Custom breakpoints for \hyphenatedurl
![](https://secure.gravatar.com/avatar/5883a55660d75172f7f5d4cc14b73a71.jpg?s=120&d=mm&r=g)
Dear list, I could successfully configure ConTeXt to introduce linebreaks /after/ some characters in URLs with \sethyphenatedurlafter {...} I would also like to disable linebreaks /before/ some of the predefined characters. For example, no linebreak should occur before : Is this possible? \sethyphenatedurlbefore {} (with empty braces) does not work. Unfortunately, usage of \sethyphenatedurlafter also introduced the following problem: the \hyphenatedurlseparator symbol now appears after the linebreak, i.e. at the beginning of the new line. Can I do something about it? Thanks and kind regards, Joshua
![](https://secure.gravatar.com/avatar/b79687264c3e06cba13b54d05b12a9f5.jpg?s=120&d=mm&r=g)
Am 05.08.2014 um 22:03 schrieb Joshua Krämer
Dear list,
I could successfully configure ConTeXt to introduce linebreaks /after/ some characters in URLs with \sethyphenatedurlafter {...}
I would also like to disable linebreaks /before/ some of the predefined characters. For example, no linebreak should occur before :
Is this possible? \sethyphenatedurlbefore {} (with empty braces) does not work.
Unfortunately, usage of \sethyphenatedurlafter also introduced the following problem: the \hyphenatedurlseparator symbol now appears after the linebreak, i.e. at the beginning of the new line. Can I do something about it?
Can you provide a working minimal example? Wolfgang
![](https://secure.gravatar.com/avatar/5883a55660d75172f7f5d4cc14b73a71.jpg?s=120&d=mm&r=g)
On 2014-08-05, 22:54, Wolfgang Schuster wrote:
Can you provide a working minimal example?
Sorry, please find an example at the end. The first URL has the right linebreaks, but the arrow should be at the end of the line. Interestingly, it shows another problem: the # is repeated. The second URL has a linebreak in front of the colon, which I do not want. Thanks and kind regards, Joshua \setuplayout[width=5cm] \def\hyphenatedurlseparator{→} \sethyphenatedurlafter {/.#} \sethyphenatedurlbefore {} \starttext \hyphenatedurl {http://optimist.optimist/optimist/optimist.optimist#optimist} Word Word Word Word \hyphenatedurl {http://optimist.optimist} \stoptext
![](https://secure.gravatar.com/avatar/b79687264c3e06cba13b54d05b12a9f5.jpg?s=120&d=mm&r=g)
Am 05.08.2014 um 23:36 schrieb Joshua Krämer
On 2014-08-05, 22:54, Wolfgang Schuster wrote:
Can you provide a working minimal example?
Sorry, please find an example at the end.
The first URL has the right linebreaks, but the arrow should be at the end of the line.
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. 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.
Interestingly, it shows another problem: the # is repeated.
Has to be fixed.
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{…} Wolfgang
![](https://secure.gravatar.com/avatar/5883a55660d75172f7f5d4cc14b73a71.jpg?s=120&d=mm&r=g)
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
participants (2)
-
Joshua Krämer
-
Wolfgang Schuster