never add a hyphen to break a URL
Hi, according to the Chicago Manual of Style we should «never add a hyphen to break a URL»: (https://www.chicagomanualofstyle.org/qanda/data/faq/topics/URLs/faq0008.html) Is there a switch to forbid \useURL adding hyphens? \starttext \useURL[test][https://litteraturbanken.se/f\%C3\%B6rfattare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil? show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only][][{https://litteraturbanken.se/f\%C3\%B6rfattare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil? show_sear-ch_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only}]\from[test]% \stoptext Steffen
On 10/24/22 18:54, Steffen Wolfrum via ntg-context wrote:
Hi,
according to the Chicago Manual of Style we should «never add a hyphen to break a URL»:
(https://www.chicagomanualofstyle.org/qanda/data/faq/topics/URLs/faq0008.html)
Hi Steffen, I think this is not even a question of style. myhouse.com and my-house.com are different domains.
Is there a switch to forbid \useURL adding hyphens?
\hyphenatedurl{} is the way to go. Although you add a hyphen (and a blank space [spaces as part of urls need to be escaped) to your url. I would also enclose the url inside \startasciimode...\stopasciimode to avoid escaping the percent sign. The percent sign has to be escaped as \letterpercent (otherwise, you get \%) in text. A simpler approach would read (there is a single url, instead of two [less typos in the end]): \setupinteraction[state=start] \starttext \def\MyURL[#1]{\goto{\tt\hyphenatedurl{#1}}[url(#1)]} \MyURL[https://litteraturbanken.se/författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil?show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only] \stoptext But https://wiki.contextgarden.net/URL has more info. Just in case it might help, Pablo
This does not open the right link. At least on my machine nothing happens when clicking on «litteraturbanken.se http://litteraturbanken.se/». (And it looks as the link was cropped, only reads the first line?) Steffen
Am 24.10.2022 um 20:04 schrieb Pablo Rodriguez via ntg-context
mailto:ntg-context@ntg.nl>: A simpler approach would read (there is a single url, instead of two [less typos in the end]):
\setupinteraction[state=start]
\starttext
\def\MyURL[#1]{\goto{\tt\hyphenatedurl{#1}}[url(#1)]}
\MyURL[https://litteraturbanken.se/författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil?show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only https://litteraturbanken.se/f%C3%B6rfattare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil?show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only] \stoptext
On 10/25/2022 11:05 AM, Steffen Wolfrum via ntg-context wrote:
This does not open the right link.
At least on my machine nothing happens when clicking on «litteraturbanken.se http://litteraturbanken.se/».
(And it looks as the link was cropped, only reads the first line?)
\setupinteraction[state=start] \useurl [litteraturbanken] [https://litteraturbanken.se] [författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil?show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only] [https://litteraturbanken.se] \starttext before \goto{\url[litteraturbanken]}[url(litteraturbanken)] after before \from[litteraturbanken] after \stoptext beware of viewer behaviour: some viewers parse the displayed pdf Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am 25.10.2022 um 11:47 schrieb Hans Hagen via ntg-context
: On 10/25/2022 11:05 AM, Steffen Wolfrum via ntg-context wrote:
This does not open the right link. At least on my machine nothing happens when clicking on «litteraturbanken.se http://litteraturbanken.se/». (And it looks as the link was cropped, only reads the first line?)
\setupinteraction[state=start]
\useurl [litteraturbanken] [https://litteraturbanken.se] [författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil?show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only] [https://litteraturbanken.se]
\starttext
before \goto{\url[litteraturbanken]}[url(litteraturbanken)] after
before \from[litteraturbanken] after
\stoptext
beware of viewer behaviour: some viewers parse the displayed pdf
Hans
…. strange, on my machine your example doesn't open the link. Please have a look here: only the last one («works …») opens the link. Why? \setupinteraction[state=start] \useurl [litteraturbanken] [https://litteraturbanken.se] [författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil?show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only] [https://litteraturbanken.se] \starttext before \goto{\url[litteraturbanken]}[url(litteraturbanken)] after before \from[litteraturbanken] after fails \useURL[test][https://litteraturbanken.se/författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil? show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only][][{https://litteraturbanken.se/författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil? show_sear-ch_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only}]\from[test] after works \useURL[test][https://litteraturbanken.se/f\%C3\%B6rfattare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil? show_search_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only][][{https://litteraturbanken.se/författare/CollijnI/titlar/ActaEtProcessusCanon/sida/614/faksimil? show_sear-ch_work&s_query=retractata&s_lbworkid=lb487378&s_mediatype=faksimil&s_word_form_only}]\from[test] after \stoptext Steffen
On 10/25/22 12:11, Steffen Wolfrum via ntg-context wrote:
[...] …. strange, on my machine your example doesn't open the link.
Please have a look here: only the last one («works …») opens the link. Why?
URIs only accept letters belonging to the US-ASCII (https://datatracker.ietf.org/doc/html/rfc3986#section-2.3). Other ones (such as "ö") have to be escaped. This is why only the sample containing the escaped "ö" (as "%C3%B6" [which TeX needs to escape again]) worked for you. It seems that depending on the PDF viewer (and I guess the browser), unescaped chars in URIs are a must or not. I’m using Evince and SumatraPDF (with Wine). Firefox opens the links fine (even using its internal viewer). Maybe Acrobat is more picky when passing unescaped chars in URIs. I hope it might help, Pablo
participants (3)
-
Hans Hagen
-
Pablo Rodriguez
-
Steffen Wolfrum