[REBOL] shifting characters in rejoin Re:
From: al:bri:xtra at: 4-Oct-2000 17:08
> I have created a function which returns something strange when I use
rejoin.
> The function is called build-html.r which builds a markup statement. Here
is the console result. Notice the closing bracket for the opening tag is
strangely moved to the end of the rejoined string:
> >> do %build-html.r
> Script: "Untitled" (none)
> == <font class="author"Ryan C. Christiansen</font>>
You've run into the interesting way that 'join works on tag!.
>> rejoin [<font> "class=" "Ryan C. Christiansen" </font>]
== <fontclass=Ryan C. Christiansen</font>>
Basically you have to convert the tags to strings to work as you'd expect,
as 'join on a tag! will put the stuff in the block inside the tag.
Something like this from my HTML! component, soon to be released on RebMail
list, and my Web Dialect list:
A: func [File [file! url!] Link [string!] /Top] [
rejoin ["" join <a> [{ href="} Encode File {"} either Top [{
TARGET="_top"}] [""]] Link </a>]
]
Which from script like this:
H1 A URL/Absolute Spectrum-Studios Name Spectrum-Studios
generates HTML like this:
<h1><a
href="http://members.nbci.com/SpectrumStudios/Spectrum Studios.html">Spect
rum Studios</a></h1>
The above line is broken by the email client I'm using.
Note that 'Spectrum-Studios is a object like:
Spectrum-Studios: Make-Page "Spectrum Studios" %"Spectrum Studios.html" [
Title Name Spectrum-Studios
Body
<snip!>
I hope that helps!
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
http://members.xoom.com/AndrewMartin/