Thank you Christian, much more elegant and I like the use of the double quote rather than looking for the "/>" or the ">" You got me thinking about valid HTML and thought I should also check for a single quote too. Hopefully, I'll be smart enough to figure it out ;-)
----- Original Message ----- From: "Christian Ensel" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 12, 2008 10:32 AM Subject: [REBOL] Re: How to properly parse HTML and XHTML Meta Tags > > The source should have been right there below the signature. > Anyway, I'll cite it again (and it's definitely REBOL ;-) > > ----- > parse-metatags: func [page [url!] /local title keywords description] [ > page: read http://www.rebol.com > > parse page [thru <title> copy title to </title>] > parse/all page [thru {<meta name="keywords" content="} copy keywords > to {"}] > parse/all page [thru {<meta name="description" content="} copy > description to {"}] > > foreach keyword keywords: parse/all any [keywords ""] "," [trim > keyword] > > reduce [ > 'title title > 'keywords keywords > 'description description > ] > ] > ----- > > Beware of unintentional line breaks in the code above due to e-mail > transportation. > > HTH, > > Christian > > > > > [EMAIL PROTECTED] schrieb: >> Hi Christian, >> >> Hmmm, both are very good points. >> Is PARSE-METATAGS in a different >> scripting language? Unable to find >> it in the Rebol dictionary or Rebol.org >> library. Thank you for your response. >> --Von >> >> ----- Original Message ----- >> From: "Christian Ensel" <[EMAIL PROTECTED]> >> To: <[EMAIL PROTECTED]> >> Sent: Friday, September 12, 2008 12:42 AM >> Subject: [REBOL] Re: How to properly parse HTML and XHTML Meta Tags >> >> >> >>> Hi Von, >>> >>> in your special case, it doesn't seem to be necessary to go thru the > >>> or /> hassle, if you rely on " as a delimiter. >>> But keep in mind that in many, many cases the solution below as well as >>> yours will fail. >>> E.g. in cases where the content and name attributes are given in reverse >>> order, which is valid HTML, too. >>> >>> However, have a look at the following PARSE-METATAGS. >>> >>> HTH, >>> Christian >>> >>> >>> > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. > -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
