ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* splitstring
@ 2002-03-16 23:35 Michael Wiedmann
  2002-03-17 10:26 ` splitstring Giuseppe Bilotta
  2002-03-17 12:02 ` splitstring Hans Hagen
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Wiedmann @ 2002-03-16 23:35 UTC (permalink / raw)


- the following line works like expected:

  \splitstring{http://some.net}\at://\to\protocol\and\tail

  I get the protocol type in \protocol and the rest in \tail.

- given an XML file with a line like

  <ulink url="http://some.net">...</ulink>

  applying the follwoing:

  \splitstring\XMLpar{ulink}{url}{}\at://\to\protocol\and\tail

  does not work like expected. Instead I get the whole URL in \protocol
  and \tail is mpty

Any hints?

Michael
-- 
mw@miwie.in-berlin.de                              http://www.miwie.org
mw@miwie.org


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

* Re: splitstring
  2002-03-16 23:35 splitstring Michael Wiedmann
@ 2002-03-17 10:26 ` Giuseppe Bilotta
  2002-03-17 16:30   ` splitstring Michael Wiedmann
  2002-03-18  9:20   ` splitstring Hans Hagen
  2002-03-17 12:02 ` splitstring Hans Hagen
  1 sibling, 2 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2002-03-17 10:26 UTC (permalink / raw)
  Cc: ntg-context

Sunday, March 17, 2002 Michael Wiedmann wrote:

MW> - given an XML file with a line like
MW>   <ulink url="http://some.net">...</ulink>
MW>   applying the follwoing:
MW>   \splitstring\XMLpar{ulink}{url}{}\at://\to\protocol\and\tail
MW>   does not work like expected. Instead I get the whole URL in \protocol
MW>   and \tail is mpty

Catcode problem, probably. What about the following:

\splitstring{\scantokens{\XMLpar{ulink}{url}{}}}\at://\to\protocol\and\tail

or

\expandafter\splitstring\expandafter{\scantokens{\XMLpar{ulink}{url}{}}}\at://\to\protocol\and\tail

--
Giuseppe "Oblomov" Bilotta


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

* Re: splitstring
  2002-03-16 23:35 splitstring Michael Wiedmann
  2002-03-17 10:26 ` splitstring Giuseppe Bilotta
@ 2002-03-17 12:02 ` Hans Hagen
  2002-03-18 10:16   ` splitstring Michael Wiedmann
  1 sibling, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2002-03-17 12:02 UTC (permalink / raw)
  Cc: ntg-context

At 12:35 AM 3/17/2002 +0100, you wrote:
>- the following line works like expected:
>
>   \splitstring{http://some.net}\at://\to\protocol\and\tail
>
>   I get the protocol type in \protocol and the rest in \tail.
>
>
>- given an XML file with a line like
>
>   <ulink url="http://some.net">...</ulink>
>
>   applying the follwoing:
>
>   \splitstring\XMLpar{ulink}{url}{}\at://\to\protocol\and\tail

    \expanded{\splitstring\XMLpar{ulink}{url}{}}\at....
     ^^^^^^^^^                                 ^

this will expand the XMLpar before feeding it to the splitter; the first 
token in \expanded is not expanded.

Hans

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-ade.nl
-------------------------------------------------------------------------


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

* Re: splitstring
  2002-03-17 10:26 ` splitstring Giuseppe Bilotta
@ 2002-03-17 16:30   ` Michael Wiedmann
  2002-03-18  9:20   ` splitstring Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Wiedmann @ 2002-03-17 16:30 UTC (permalink / raw)
  Cc: ntg-context

* Giuseppe Bilotta <bourbaki@bigfoot.com> [020317 11:26]:

> Catcode problem, probably. What about the following:

None of your suggestions work :-(

Michael
-- 
mw@miwie.in-berlin.de                              http://www.miwie.org
mw@miwie.org


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

* Re: splitstring
  2002-03-17 10:26 ` splitstring Giuseppe Bilotta
  2002-03-17 16:30   ` splitstring Michael Wiedmann
@ 2002-03-18  9:20   ` Hans Hagen
  2002-03-18 13:58     ` Re[2]: splitstring Giuseppe Bilotta
  1 sibling, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2002-03-18  9:20 UTC (permalink / raw)
  Cc: ntg-context

At 11:26 AM 3/17/2002 +0100, Giuseppe Bilotta wrote:

>Sunday, March 17, 2002 Michael Wiedmann wrote:
>
>
>MW> - given an XML file with a line like
>MW>   <ulink url="http://some.net">...</ulink>
>MW>   applying the follwoing:
>MW>   \splitstring\XMLpar{ulink}{url}{}\at://\to\protocol\and\tail
>MW>   does not work like expected. Instead I get the whole URL in \protocol
>MW>   and \tail is mpty
>
>Catcode problem, probably. What about the following:
>
>\splitstring{\scantokens{\XMLpar{ulink}{url}{}}}\at://\to\protocol\and\tail
>
>or
>
>\expandafter\splitstring\expandafter{\scantokens{\XMLpar{ulink}{url}{}}}\at://\to\protocol\and\tail

beware, scantokens adapts to the current catcode regime; when a macro is 
loaded it's kind of frozen, so then a \ is still a \, while in xml mode, 
the \ is something different, so here scantokens would read the data as 
being xml (unless xml mode is temporary disables).

I guess that this fuzzy explanation will make you go into the tex source 
code -)

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-ade.nl
-------------------------------------------------------------------------


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

* Re: splitstring
  2002-03-17 12:02 ` splitstring Hans Hagen
@ 2002-03-18 10:16   ` Michael Wiedmann
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Wiedmann @ 2002-03-18 10:16 UTC (permalink / raw)


* Hans Hagen <pragma@wxs.nl> [020317 13:02]:

>    \expanded{\splitstring\XMLpar{ulink}{url}{}}\at....
>     ^^^^^^^^^                                 ^
> 
> this will expand the XMLpar before feeding it to the splitter; the first 
> token in \expanded is not expanded.

Thanks Hans, this works!

Michael
-- 
mw@miwie.in-berlin.de                              http://www.miwie.org
mw@miwie.org


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

* Re[2]: splitstring
  2002-03-18  9:20   ` splitstring Hans Hagen
@ 2002-03-18 13:58     ` Giuseppe Bilotta
  2002-03-18 14:42       ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Giuseppe Bilotta @ 2002-03-18 13:58 UTC (permalink / raw)
  Cc: ntg-context

Monday, March 18, 2002 Hans Hagen wrote:

HH> beware, scantokens adapts to the current catcode regime; when a macro is
HH> loaded it's kind of frozen, so then a \ is still a \, while in xml mode, 
HH> the \ is something different, so here scantokens would read the data as 
HH> being xml (unless xml mode is temporary disables).

HH> I guess that this fuzzy explanation will make you go into the tex source 
HH> code -)

No, it just drives me mad for this crazy expansion/catcode mechanism of
TeX 8-)

--
Giuseppe "Oblomov" Bilotta


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

* Re[2]: splitstring
  2002-03-18 13:58     ` Re[2]: splitstring Giuseppe Bilotta
@ 2002-03-18 14:42       ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2002-03-18 14:42 UTC (permalink / raw)
  Cc: ntg-context

At 02:58 PM 3/18/2002 +0100, you wrote:

>Monday, March 18, 2002 Hans Hagen wrote:
>
>HH> beware, scantokens adapts to the current catcode regime; when a macro is
>HH> loaded it's kind of frozen, so then a \ is still a \, while in xml mode,
>HH> the \ is something different, so here scantokens would read the data as
>HH> being xml (unless xml mode is temporary disables).
>
>HH> I guess that this fuzzy explanation will make you go into the tex source
>HH> code -)
>
>No, it just drives me mad for this crazy expansion/catcode mechanism of
>TeX 8-)

actually, in itself catcodes are a nice concept, but there should have been 
provisions to push / pop states (too slow in macros)

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-ade.nl
-------------------------------------------------------------------------


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

end of thread, other threads:[~2002-03-18 14:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-16 23:35 splitstring Michael Wiedmann
2002-03-17 10:26 ` splitstring Giuseppe Bilotta
2002-03-17 16:30   ` splitstring Michael Wiedmann
2002-03-18  9:20   ` splitstring Hans Hagen
2002-03-18 13:58     ` Re[2]: splitstring Giuseppe Bilotta
2002-03-18 14:42       ` Hans Hagen
2002-03-17 12:02 ` splitstring Hans Hagen
2002-03-18 10:16   ` splitstring Michael Wiedmann

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