From: Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: hyphenated url
Date: Thu, 28 Oct 2010 00:05:36 +0200 [thread overview]
Message-ID: <20101027220536.GA11182@aides> (raw)
In-Reply-To: <A758F89C-03EF-41A1-95A3-1F69B19FF258@st.estfiles.de>
[-- Attachment #1.1: Type: text/plain, Size: 6813 bytes --]
On 2010-10-27 <22:28:56>, Steffen Wolfrum wrote:
>
> Hi,
>
> I tried an other approach: \useURL
>
> But here the letterpercent trick doesn't work at all ... ie.
> there is no clickable link at all anymore!
Hi Steffen,
if you consider an environment-style version of ‘\useURL’
appropriate, you could hack your way through like this:
···8<····························································
\setupinteraction[state=start]
\unprotect
\newcatcodetable \urlcatcodes
\startcatcodetable \urlcatcodes
\catcode`\^^I = 10
\catcode`\^^M = 5
\catcode`\^^L = 5
\catcode`\ = 10
\catcode`\^^Z = 9
\catcode`\\ = 0
\catcode`\{ = 1
\catcode`\} = 2
\catcode`\$ = \@@other
\catcode`\& = \@@other
\catcode`\# = \@@other
\catcode`\^ = \@@other
\catcode`\_ = \@@other
\catcode`\~ = \@@other
\catcode`\| = \@@other
\catcode`\% = \@@other
\catcode`\* = \@@other
\stopcatcodetable
\startluacode
function structures.references.urls.get(name,method,space)
local u = structures.references.urls.data[name]
if u then
local url, file = u[1], u[2]
if file and file ~= "" then
context("%s/%s",url,file)
else
context.pushcatcodes("vrb")
context(url)
context.popcatcodes()
end
end
end
\stopluacode
\def\startuseURL{%
\bgroup%
\catcodetable \urlcatcodes
\dodoubleempty\dostartuseURL%
}
\let\stopuseURL\relax
\def\dostartuseURL[#1][#2]#3\stopuseURL{
\egroup
\ctxlua{structures.references.urls.define("#1",string.strip(\!!bs\detokenize{#3}\!!es),"",\!!bs\detokenize{#2}\!!es)}
}
% Usage example here:
\startuseURL[anotherurl][urldescription]
http://test%it.example.com
\stopuseURL
\starttext
\from[anotherurl]\par
\url[anotherurl]\par
Test.\footnote{\url[anotherurl]}
\stoptext
···8<····························································
This deviates from standard ‘\useURL’ in the order of parameters:
\startuseURL[#1][#2]
#3
\stopuseURL
where #1 is the id, #2 is the display text and #3 the url itself.
This eliminates the need to resort to ‘\letterpercent’ as well
and works in footnotes.
Philipp
>
>
> \setupinteraction
> [state=start]
>
> \showframe
>
> \starttext
>
> \useURL[aurl] [http://www.kommers.se/upload/Analysarkiv/In\letterpercent English/Analyses/Woolcock\letterpercent paper\letterpercent on\letterpercent impact\letterpercent of\letterpercent Lisbontreaty\letterpercent on\letterpercent tradepolicy.pdf] [] [http://www.kommers.se/upload/Analysarkiv/In\letterpercent English/Analyses/Woolcock\letterpercent paper\letterpercent on\letterpercent impact\letterpercent of\letterpercent Lisbontreaty\letterpercent on\letterpercent tradepolicy.pdf]
>
> test \from[aurl] text
> \stoptext
>
>
>
>
> Steffen
>
>
>
>
>
>
> Am 25.10.2010 um 15:12 schrieb Philipp Gesang:
>
> > On 2010-10-25 <12:45:17>, Steffen Wolfrum wrote:
> >>
> >> Am 25.10.2010 um 12:26 schrieb Philipp Gesang:
> >>> \unexpanded\gdef\hyphenatedurl
> >>>
> >>> Should work in footnotes. Regards, Philipp
> >>
> >>
> >> No, it doesn't (see below).
> >> Do you have an other idea?
> >
> > Right; it works in footnotes but doesn’t accomplish what you
> > want. Sorry, I tried a lot but ‘\letterpercent’ is the only
> > way it works for me.
> >
> > Concerning the urlencoding I referred to browsers automatically
> > converting raw urls, like for instance
> >
> > http://www.google.com/search?q=ähre
> >
> > , which is encoded as
> >
> > http://www.google.com/search?q=%C3%A4hre
> >
> > by my browser. As long as your urls mainly consist of unicode
> > strings you might not need the actual (ascii) percent sign. In
> > this case you could be fine simply by converting strings like
> > ‘%C3%A4hre’ to ‘Ähre’, rendering urls percent-less, and rely on
> > the browsers to re-encode them on the fly. Might be a bit far
> > fetched, though.
> >
> > Philipp
> >
> >
> >>
> >> Thanks, Steffen
> >> (ConTeXt ver: 2010.10.21)
> >>
> >>
> >> Runaway argument?
> >> {test \hyphenatedurl {www.test\par \stoptext \par
> >> ! File ended while scanning use of \@@notemakedescription.
> >>
> >> system > error on line 0 in file : File ended while scanning use of \@@notemakedescription ...
> >>
> >>
> >> \let\normalhyphenatedurl\hyphenatedurl
> >>
> >> \bgroup
> >>
> >> \catcode`\%=11
> >>
> >> \unexpanded\gdef\hyphenatedurl
> >> {\bgroup
> >> \catcode`\%=11
> >> \expandafter\egroup
> >> \normalhyphenatedurl}
> >>
> >> \egroup
> >>
> >> \setupinteraction
> >> [state=start]
> >>
> >> \starttext
> >>
> >> text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
> >>
> >> \stoptext
> >>
> >>
> >>
> >>
> >> ___________________________________________________________________________________
> >> If your question is of interest to others as well, please add an entry to the Wiki!
> >>
> >> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> >> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> >> archive : http://foundry.supelec.fr/projects/contextrev/
> >> wiki : http://contextgarden.net
> >> ___________________________________________________________________________________
> > ___________________________________________________________________________________
> > If your question is of interest to others as well, please add an entry to the Wiki!
> >
> > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> > archive : http://foundry.supelec.fr/projects/contextrev/
> > wiki : http://contextgarden.net
> > ___________________________________________________________________________________
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 486 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2010-10-27 22:05 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-25 8:25 Steffen Wolfrum
2010-10-25 9:16 ` Philipp Gesang
2010-10-25 9:39 ` Steffen Wolfrum
2010-10-25 9:50 ` Philipp Gesang
2010-10-25 10:05 ` Steffen Wolfrum
2010-10-25 10:26 ` Philipp Gesang
2010-10-25 10:45 ` Steffen Wolfrum
2010-10-25 13:12 ` Philipp Gesang
2010-10-25 15:52 ` Steffen Wolfrum
2010-10-27 21:30 ` Peter Münster
2010-10-27 20:28 ` Steffen Wolfrum
2010-10-27 22:05 ` Philipp Gesang [this message]
2010-10-28 6:46 ` Steffen Wolfrum
2010-10-28 7:38 ` Peter Münster
2010-10-28 8:03 ` Philipp Gesang
2010-10-25 10:06 ` Steffen Wolfrum
2010-10-25 17:30 ` Aditya Mahajan
2010-10-25 20:25 ` Steffen Wolfrum
2010-10-25 21:00 ` Aditya Mahajan
2010-10-25 21:47 ` Wolfgang Schuster
2010-10-25 22:49 ` Philipp Gesang
2010-10-26 8:57 ` Steffen Wolfrum
2010-10-27 10:35 ` Steffen Wolfrum
2010-10-27 12:43 ` Wolfgang Schuster
2010-10-27 14:56 ` Peter Münster
2010-10-27 15:11 ` Steffen Wolfrum
2010-10-27 15:59 ` Wolfgang Schuster
2010-10-27 16:20 ` Thomas A. Schmitz
2010-10-27 17:08 ` Peter Münster
2010-10-27 17:22 ` Peter Münster
2010-10-27 18:31 ` Aditya Mahajan
2010-10-27 18:49 ` Peter Münster
2010-10-28 9:03 ` Hans Hagen
2010-10-28 9:53 ` Peter Münster
2010-10-28 11:02 ` Khaled Hosny
2010-10-28 11:52 ` Peter Münster
2010-10-28 12:59 ` Wolfgang Schuster
2010-10-28 6:53 ` Taco Hoekwater
2010-10-28 12:06 ` hyphenated url (SOLVED) Steffen Wolfrum
2010-10-28 12:50 ` hyphenated url Wolfgang Schuster
2010-10-31 6:06 ` Aditya Mahajan
2010-10-31 9:50 ` Steffen Wolfrum
[not found] ` <FC31827A-E920-47C4-9287-8BEE605CE94D@st.estfiles.de>
2010-10-31 20:25 ` Aditya Mahajan
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=20101027220536.GA11182@aides \
--to=pgesang@ix.urz.uni-heidelberg.de \
--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).