remove html tags from text

Jim Ault JimAultWins at yahoo.com
Fri Sep 8 10:07:16 CDT 2006


I would add a loop to clean up the formatting of the returned text, since
html formatting is usually done for the convenience of the programmer, not
the viewer.

On 9/8/06 6:10 AM, "Mark Smith" <mark at maseurope.net> wrote:

> barely tested, but maybe a starting point:
> 
> function striptags tHtml
>    replace cr with empty in tHtml -- in case of multi-line tags
> 
>    replace "<" with cr & "<" in tHtml
>    replace ">" with ">" & cr in tHtml
> 
>    filter tHtml without "*<*"
>    filter tHtml without "*>*"
    repeat for each line LNN in tHtml
      put word 1 to -1 of LNN  & cr after newHtml
   end repeat
   filter newHtml without empty
-- now there are no leading/trailing spaces, no empty lines

replace cr with space in newHtml
--now there are no cr's, since you would not know where they should be if
 --the tags are simply stripped.
--To get the paragraphs of an html page is tricky, since there are several
 --tags and techniques for displaying blocks of text (<p><BR><td><span>)

   return newHtml
>    --return tHtml
> end striptags
> 
> best,
> 
> Mark
> 
> On 8 Sep 2006, at 13:52, paolo mazza wrote:
> 
>> just a simple task for Revolution!
>> How can I remove html tags from text?
>> 
>> i.e.
>> from: try  <b> solve<b> this <<httpk.hhkjhlkjlljkl= hkjh> quiz </a>
>> to:  try   solve  this   quiz
>> 
>> I should use a wildcard  but ....
>> 
>> filter TEXT with "<*>" does not work.  It is only for a list.
>> 
>> I do not want to put the Text in a field and use the HtmlText.
>> 
>> Ciao
>> 
>> Paolo Mazza
>> ********************************************************
>> Paolo Mazza
>> NEOL SRL
>> Via Calatafimi, 16 - 35137 PADOVA
>> www.neol.it   paolo.mazza at neol.it
>> Tel 049-7386590
>> 
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list