Stripping html tags (was Re: Problem with revExecuteSQL - More)
Richard Gaskin
ambassador at fourthworld.com
Fri Nov 2 13:46:28 EDT 2007
Andre Garzia wrote:
> doesn't that function makes you loose markup that is not displayed by
> rev implementation of htmltext. For example, if you have <DIV> tag
> that is not understood by htmltext, do you still get its content when
> querying the text of the field?
Good question.
I just opened up my tester stack, which has a field containing styled
text which is used as the source htmlText. Right after I put the
htmlText of that field into a var named tData, I added this line:
put "<div>Some DIV data</div>"&cr before tData
Both my and Jim's stripper functions return the same result, which
includes in the first line:
Some DIV data
There may be other tags which don't work well, and I'd be interested if
we could find specific examples. But IIRC, for tags Rev doesn't
interpret when setting htmlText, it doesn't display the tag but does
display the content.
This has been a long-standing annoyance with the engine among some
people, because it renders the content of elements like <head> which are
not normally seen in a browser but would be seen in a Rev field.
But if the rule is indeed "When in doubt, leave it in" it would seem
more beneficial for the greatest number of uses, since it's easy enough
to strip any specific unwanted elements.
This discussion had me wondering, "What does Rev do about comments?", so
I added this line and ran my test again:
put "<!-- Some comment data -->"&cr before tData
Interestingly, it seems comments are removed when rendered as htmlText,
which seems appropriate for most uses.
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
More information about the use-livecode
mailing list