ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: URL as parameter...
       [not found] <20000614100157.11715.qmail@crux.private.off-line>
@ 2000-06-14 13:58 ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2000-06-14 13:58 UTC (permalink / raw)
  Cc: ntg-context

>The following source still does not work. The typesetting is correct, but 
>the url passed to Netscape is still incorrect. The tilde is expanded 
>somewhere. The url that is mangled by the macro, is passed to netscape as:
>"http://www.xs4all.nl/ ormalpenalty 10000 vnf/" instead of
>"http://www.xs4all.nl/~vnf/". Netscape does not appreciate this...

Ah, you're talking about the non typeset one. I can fix that one, but it
must be done careful, so I'll do it when I have time for it. The problem is
in passing the dangerous ~ as argument, and \useURL handles that in a
special way, but only outside macros. You can define your test as: 

\def\utest#1%
  {{\def~{\string~}\useURL[tmp][#1]\goto{\url[tmp]}[URL(tmp)]}}

\def\utest#1%
  {{\let~\tildeletter\useURL[tmp][#1]\goto{\url[tmp]}[URL(tmp)]}}

\def\utest#1%
  {\convertargument#1\to\ascii
   \expanded{\useURL[tmp][\ascii]}%
   \goto{\url[tmp]}[URL(tmp)]}

Hans   

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: URL as parameter...
  2000-06-12 20:46 ` Joop Susan
@ 2000-06-13 20:06   ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2000-06-13 20:06 UTC (permalink / raw)
  Cc: ntg-context

At 10:46 PM 6/12/2000 +0200, Joop Susan wrote:
>> > Can anyone tell me how to pass a URL as a parameter to a 
>> > macro if there is 
>> > a tilde character present in the string. In the following 
>> 
>> Perhaps use something that really is a tilde:
>> 
>> \def\MyTilde{\tttf ~}
>> 
>> \useURL[test][test/\MyTilde test]
>> 
>
>\url seems to use a diferent mechnism. I was hoping there is something
>similar for this case. I'm afraid I'm not very good at understanding 
>ConTEXt source. ;-)

Indeed a different mechanism: ~ as well as \~ are handled. The \url macro
takes care of sanitizing chars as well as breaking url's. The \useURL is
more robust. Anyhow, it should work ok, even in situations where the url is
passed as argument. I remember that tobias and I spend quite some time
discussing the ways to hyphenate them,so there are even different
strategies available. 

Hans  

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: URL as parameter...
  2000-06-12 14:47 Joop Susan
  2000-06-12 18:16 ` Berend de Boer
@ 2000-06-13 20:03 ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2000-06-13 20:03 UTC (permalink / raw)
  Cc: ntg-context

At 04:47 PM 6/12/2000 +0200, Joop Susan wrote:

>a tilde character present in the string. In the following example, the 
>direct version works, but the macro version has it's '~' character 
>substituted by white space.

Strange, since it works here. Do you use a recent version of context? 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: URL as parameter...
@ 2000-06-12 20:46 ` Joop Susan
  2000-06-13 20:06   ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Joop Susan @ 2000-06-12 20:46 UTC (permalink / raw)


> > Can anyone tell me how to pass a URL as a parameter to a 
> > macro if there is 
> > a tilde character present in the string. In the following 
> 
> Perhaps use something that really is a tilde:
> 
> \def\MyTilde{\tttf ~}
> 
> \useURL[test][test/\MyTilde test]
> 

\url seems to use a diferent mechnism. I was hoping there is something
similar for this case. I'm afraid I'm not very good at understanding 
ConTEXt source. ;-)

> Groetjes,
> 
> Berend. (-:
> 
> 

Joop


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: URL as parameter...
  2000-06-12 14:47 Joop Susan
@ 2000-06-12 18:16 ` Berend de Boer
  2000-06-13 20:03 ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Berend de Boer @ 2000-06-12 18:16 UTC (permalink / raw)


> Can anyone tell me how to pass a URL as a parameter to a 
> macro if there is 
> a tilde character present in the string. In the following 

Perhaps use something that really is a tilde:

\def\MyTilde{\tttf ~}

\useURL[test][test/\MyTilde test]

Groetjes,

Berend. (-:


^ permalink raw reply	[flat|nested] 6+ messages in thread

* URL as parameter...
@ 2000-06-12 14:47 Joop Susan
  2000-06-12 18:16 ` Berend de Boer
  2000-06-13 20:03 ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Joop Susan @ 2000-06-12 14:47 UTC (permalink / raw)


Hello,

Can anyone tell me how to pass a URL as a parameter to a macro if there is 
a tilde character present in the string. In the following example, the 
direct version works, but the macro version has it's '~' character 
substituted by white space.

==================================================

\starttext

\setupcolors[state=start]

\setupinteraction [state=start]

\setupurl
    [style=italic]

{\bf Direct:}

\useURL[tmp][http://www.xs4all.nl/~vnf/]
\goto {\url[tmp]}[URL(tmp)]

{\bf Macro:}

\def\utest#1%
{\useURL[tmp][#1]
 % ...
 % ...
 \goto {\url[tmp]}[URL(tmp)]}

\utest{http://www.xs4all.nl/~vnf/}

\stoptext

==================================================

Joop


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-06-14 13:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20000614100157.11715.qmail@crux.private.off-line>
2000-06-14 13:58 ` URL as parameter Hans Hagen
     [not found] <Your message of "Mon, 12 Jun 2000 20:16:57 +0200." <00c001bfd49a$659c08c0$0321a8c0@bmach.nederware.nl>
2000-06-12 20:46 ` Joop Susan
2000-06-13 20:06   ` Hans Hagen
2000-06-12 14:47 Joop Susan
2000-06-12 18:16 ` Berend de Boer
2000-06-13 20:03 ` Hans Hagen

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).