[REBOL] Re: How to properly parse HTML and XHTML Meta Tags
From: vonja:sbcglobal at: 12-Sep-2008 0:06
Thanks Tom,
I kept on plugging away and came up with I believe
a working script. It's going to take some time for
me to digest what you've written me. I'll play around
with yours tomorrow; I really appreciate your help!
I've updated note 1 that you had provided me :-)
Here's what I came up with right before you sent
your reply.
page: read http://www.rebol.com ; webpage to be parsed
title: copy "" description: copy [] keywords: copy []
parse page [ thru <title> copy title to </title>]
print title
parse page [ thru "<meta name=^"keywords^" content=" copy keywords to
]
either not none? (find/last keywords "/") [
keywords: tail keywords
keywords-tail: skip keywords -1
if keywords-tail = "/" [keywords: remove keywords-tail]
print head keywords
][if/else empty? keywords [print "blank"][print keywords]]
parse page [ thru "<meta name=^"description^" content=" copy
description to ">" ]
either not none? (find/last description "/") [
description: tail description
description-tail: skip description -1
if description-tail = "/" [description: remove description-tail]
print head description
][if/else empty? description [print "blank"][print description]]