Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Parse Question: html-to-text conversion help.

From: brett:codeconscious at: 2-May-2002 11:17

Hi Alan,
> link: [some [thru "<a href=" copy lnk to ">" (append text lnk)]] > > ... but is there any way to add this to the converter below?
Some modifications. I changed link to remove the some. I embed link inside html-rules. So it will have the first go at the tag. If it is a link tag it continues on, if it is not the previous html-rule logic comes into play. link: ["<a href=" copy lnk to ">" (append text lnk)] html-rules: [ to "<" some [ link | ["<" thru ">"] | copy txt to "<" (append text txt) ] ] Your next problem might be to make the link rule be able to handle the case where the tag has more attributes than just the HREF. If you need to do this, then have a look at: In particular the NEW-TAG rule and its supporting rules. A demonstration of what this script does is:
>> import-tag <a href="">
== [a href ""] Regards, Brett.