Hi, here is a patched BUILD-TAG function. The main difference to the =20
original version is that if the value part is NONE no, attribute will be =
=20
included. This makes creating HTML tags much simpler. Example:
action: script.cgi
method: none
Old: build-tag [form action (action) method (method)]
>> <form action=3D"script.cgi" method=3D"none">
New: build-tag [form action (action) method (method)]
>> <form action=3D"script.cgi">
build-tag: func [
"Generates a tag from a composed block."
values [block!] "Block of parens to evaluate and other data."
/local tag value-rule xml? name attribute value]
[
tag: make string! 7 * length? values
value-rule: [
set value issue! (value: mold value)
| set value file! (value: replace/all copy value #" " "%20")
| set value any-type!
]
xml?: false
parse compose values [
[
set name ['?xml (xml?: true) | word!] (append
tag name)
any [
set attribute [word! | url!]
value-rule (
if found? value [repend
tag [#" " attribute {=3D"} value {"}]]
)
| value-rule (if found? value [repend
tag [#" " value]])
]
end (if xml? [append tag #"?"])
]
| [set name refinement! to end (tag: mold name)]
]
to tag! tag
]
--=20
Robert M. M=FCnch
Management & IT Freelancer
Mobile: +49 (177) 245 2802
http://www.robertmuench.de
--
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.