Hi Ryan,

Andrew Martin already answered you, but maybe this provides a little
different perspective ...

The results look strange because the < and > aren't part of the tag!
data, they just delimit it.

>> length? <TAG>
== 3

When you do

   markup-string: rejoin [open-tag data/name close-tag]

the first item in REJOIN's block argument is a tag, so the result is
a tag. But before close-tag is appended, it is formed to a string,
which causes the delimiting < > to actually become characters of data.

A tag! is meant to represent only one tag. If you want to have more than one
tag in an HTML element, you need to make a string. So it's very easy to
correct your function. Replace the line quoted above with:

   markup-string: rejoin ["" open-tag data/name close-tag]

Eric

>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>>
>>>
>
>Your input would be helpful.  -Ryan
>
>Here is the script:
>
>REBOL []
>
>author: make object! [
>    name: "Ryan C. Christiansen"
>    email-address: [EMAIL PROTECTED]
>    stylesheet-info: make object! [
>        tag-style: "font"
>               class-name: "author"
>    ]
>]
>
>build-html: func [
>    {Build an HTML page element including the data to be displayed
>     and the markup language surrounding the data.}
>    data [object!] "the data to be marked up"
>][
>    open-tag: build-tag [(data/stylesheet-info/tag-style) class
>         (data/stylesheet-info/class-name)]
>
>    close-tag: rejoin [{</} data/stylesheet-info/tag-style {>}]
>
>    markup-string: rejoin [open-tag data/name close-tag]
>
>    markup-string
>
>]
>
>build-html author

Reply via email to