another tag! issue
[1/7] from: hallvard::ystad::helpinhand::com at: 26-Jan-2002 23:07
Hi again
OK, so I accept that RT wants all characters in tags to be accessible, so that <a href="">
and <a href = ""> are not alike. But how about this:
>> print <a href="">
<a href="">
>> print join <a href=""> "^/"
<a href=""
>>
It seems JOIN <a href=""> "^/" puts in the linebreak too early. Or am I mistaken again?
If I FORM or MOLD the TAG!, it seems to work fine...
~H
[2/7] from: al:bri:xtra at: 27-Jan-2002 11:19
Hallvard wrote:
>> print <a href="">
<a href="">
>> print join <a href=""> "^/"
<a href=""
>>
> It seems JOIN <a href=""> "^/" puts in the linebreak too early. Or am I
mistaken again? If I FORM or MOLD the TAG!, it seems to work fine...
It seems to be in exactly the right place to me. Do you want to put a URL in
the tag? Or do you want to add an extra parameter to the anchor tag?
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[3/7] from: carl:cybercraft at: 27-Jan-2002 11:43
On 27-Jan-02, Hallvard Ystad wrote:
> Hi again
> OK, so I accept that RT wants all characters in tags to be
<<quoted lines omitted: 9>>
> am I mistaken again? If I FORM or MOLD the TAG!, it seems to work
> fine...
You're mistaken again. (: 'join determines the type of what's returned
by the first value it's given, (in certain cases), so this returns a
tag...
>> a: join <a href=""> "^/"
== <a href=""
>> type? a
== tag!
and this a string...
>> a: join "^/" <a href="">
== {
<a href="">}
>> type? a
== string!
I said "in certain cases" as it returns a string where joining to a
datatype doesn't make sense, as with numbers...
>> join 10 20
== "1020"
HTH.
--
Carl Read
[4/7] from: joel:neely:fedex at: 26-Jan-2002 17:40
Hi, Hallvard,
There's more consistency that meets the eye, just not well
documented...
Hallvard Ystad wrote:
> Hi again
> OK, so I accept that RT wants all characters in tags to be
<<quoted lines omitted: 7>>
> >>
> It seems JOIN <a href=""> "^/" puts in the linebreak too early.
Think of TAG! as a subtype of STRING! which uses < and > as its
delimiters instead of " and " or { and } .
Consider this console transcript, which makes it clear that the
corner-brackets are the syntax that identifies a tag, but are
not part of the tag's data content:
>> foo: <a href="">
== <a href="">
>> foreach item foo [print item]
a
h
r
e
f
"
"
Now let's try another example:
>> baz: join foo { border="0"}
== <a href="" border="0">
which shows that JOIN (as well as the other series operations,
including APPEND, etc.) will operate on the *data*content* of
the tag, which doesn't include the delimiters. I simply used
a printable string instead of the whitespace value of "^/" to
make the illustration more visible.
After all, if I wrote
foo: {a href=""}
and then evaluated
join foo "###"
you'd expect to get a result which would MOLD something like
{a href=""###}
instead of
{a href=""}###
wouldn't you?
> Or am I mistaken again? If I FORM or MOLD the TAG!, it seems
> to work fine...
>
But the effect of FORM or MOLD is to manufacture a STRING! value
from other data types. It just happens that the external format
for a TAG! value is always bracketed with the < and > to make it
clear that we're dealing with something other than a plain string.
HTH!
-jn-
--
; sub REBOL {}; sub head ($) {@_[0]}
REBOL []
# despam: func [e] [replace replace/all e ":" "." "#" "@"]
; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"}
print head reverse despam "moc:xedef#yleen:leoj" ;
[5/7] from: rotenca:telvia:it at: 27-Jan-2002 2:51
Hi Hallvard,
> I said "in certain cases" as it returns a string where joining to a
> datatype doesn't make sense, as with numbers...
>
> >> join 10 20
> == "1020"
There is also this kind of exception (or bug? or special rule?):
>> t? join <4> 3
== tag!
>> t? join 3 <4>
== string!
>> t? join <4> $3
== tag!
>> t? join $3 <4>
== string!
>> t? join 3 #4
== string!
>> t? join 3 make image! [12x12]
== string!
and so on, the rule seems:
join any-string! scalar! = any-string!
join scalar! any-string! = string!
---
Ciao
Romano
[6/7] from: rotenca:telvia:it at: 27-Jan-2002 3:00
Hi Carl,
> You're mistaken again. (: 'join determines the type of what's returned
> by the first value it's given, (in certain cases), so this returns a
> tag...
Forget my previous message: the rule is exactly and at all what you say. Only
the first value is significant, if it is a scalar then the result datatype
defaults to string. This is true also for rejoin.
---
Ciao
Romano
[7/7] from: hallvard:ystad:helpinhand at: 27-Jan-2002 13:31
Thanks, folks, my mistake again. Looking upon <a href=""> as a datatype delimited by
< and > was smart, thanks. It makes sense now. I no longer consider my workaround as
a workaround, but as the way to do it. (To print a tag followed by a linebreak: print
join form <a href=""> "^/").
~H
Dixit Carl Read (00.43 27.01.2002):
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted