Hallo Nigel,
Andrew's version is even shorter than mine, doing it by just
'change -ing instead of 'remove -ing and 'insert -ing.
Nevertheless, here's my version with additinal comments:
parse post [
any ; apply the following rule 0 or more times
[
to "[url]" ; jumps to the first occurence of "[url]"
; we're right ahead of it now
tag: ; remember the position in the string
5 skip ; skip 5 characters ("[url]")
copy url to "[/url]" ; copy everthing till we encounter a
; string "[/url]"
; 'url now holds the url, but not the brackets
; all the above is the 'parse dialect
( ; start of code (non-dialect) section
remove/part tag add length? url 11
; remove length? url plus additional 11
; chars ("[url]" = 5 + "[/url]" = 6)
; from the input string,
; counting from the position we told
; 'parse to remember in 'tag
insert tag rejoin [
{<a href="} url {" target="_blank">} url {</a>}
]
; composes the html-tag and inserts
; it at the position 'tag
; voila!
) ; end of code section
]
to end
]
If you want to learn about 'parse see the new user guide on rebol.com,
chapter 14. Have fun!
Christian
[EMAIL PROTECTED]
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.