[REBOL] "Smart Tags"
From: ryan::christiansen::intellisol::com at: 15-Jun-2001 10:27
There is a lot of discussion surroundings Microsoft's use of "Smart Tags"
in I.E. 6.0 which will ship with Windows XP. Well, if you can't wait for
I.E. 6.0, you can make your own "Smart Tags" with REBOL.
Try it here...
http://test.fargonews.com/smart-tags.html
Following are the functions used to generate "Smart Tags." Enjoy!
search: func [
keywords [string!] "search words"
][
replace/all keywords " " "+"
google-search-url: make url! (rejoin [http://www.google.com/search?qkeywords])
results: read google-search-url
urls-with-keywords: copy []
parse results [thru {<p><A HREF=} copy text to {>} (append
urls-with-keywords text)]
urls-with-keywords
]
smart-tags: func [
plain-text [string!] "plain text to be marked up with hyperlinks"
][
plain-text-words: parse plain-text none
foreach plain-text-word plain-text-words [
hyperlink-url: search plain-text-word
a-tag-begin: build-tag [a href (hyperlink-url)]
insert plain-text-word a-tag-begin
append plain-text-word {</A> }
]
plain-text-words
]
-Ryan