can't trust htmltext property!

Richard Gaskin ambassador at fourthworld.com
Tue Nov 29 13:44:14 EST 2005


Eric Chatonet wrote:
> Hi Andre,
> 
> Unfortunately, Rev HTML is not HTML :-(
> 
>  From the docs:
> The HTMLText property uses a tag structure that is HTML-like, but is  
> not completely standard HTML, in order to accommodate the full range  of 
> text styling available in Revolution.
> 
> And:
> When you set the HTMLText of a field, all tags other than those above  
> are ignored, except heading tags (<h1>--<h6>), which change the size  of 
> the text in the heading element:
>     tag        textSize
>     <h1>        34 point
>     <h2>        24 point
>     <h3>        18 point
>     <h4>        14 point
>     <h5>        12 point
>     <h6>        10 point

Great info, Eric. Thanks for posting that.

Andre, as Eric pointed out what Rev calls "htmlText" is really 
"sgmlBasedFormattingThatHappensToLookALotLikeOldSchoolHtml", but that 
property name was too long so it got shortened to "htmlText". :)

The purpose for htmlText within Rev is to provide an ASCII-based method 
of describing all text attributes supported in the engine, including 
things like threeDbox, strikeOut, and others not commonly found in HTML. 
  It allows you to reproduce text within Rev with complete fidelity from 
field to field, and since it's ASCII you can use chunk expressions 
and/or regex or any other ways to manipulate it easily in between fields.

So while the choice of the token name is arguably problematic, the 
implementation does what it was designed to do very well.

It's worth noting that htmlText goes further than RtfText (if memory 
serves), as RtfText was designed for interoperability with other 
document systems and doesn't include all of Rev's native text attributes 
as htmlText does. (I could be wrong on that, and if someone knows for 
sure that rtfText renders all attributes from field to field with 
complete fidelity I'll be quite happy to have been mistaken).

Although designed for internal use (what would "H3" mean in a system 
that uses absolute rather than relative text sizes?), with Eric's chart 
you can easily write a function to alter htmlText into a form compatible 
with most web browsers.

--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list