Help with Html to text conversion

Terry Vogelaar terry at discovery.nl
Mon Jul 22 23:56:01 EDT 2002


>> Anyone have a transcript script or OS X external function to convert
>> HTML to Text? I have an external function but it wont work with OS X.
>
> This was posted by David Vaughan a couple of months ago:
> 
> function stripHTML aData
>    repeat for each line aLine in aData
>      repeat while matchchunk(aLine,"<*>")
>        delete char offset("<",aLine) to offset(">",aLine) of aLine
>      end repeat
>      put aLine & return after outData
>    end repeat
>    return outData
> end stripHTML
>
> I haven't tried it myself, but it looks good.

This removes the tags only; the &specialChars; will remain weird and
unreadable. Personally I think the best way is:

  set the htmlText of field "temp" to aData
  put field "temp" into outData

Terry





More information about the Use-livecode mailing list