Htmltext: storing data in markup

Ben Rubinstein benr_mc at
Thu Jan 27 09:20:59 EST 2011

On 27/01/2011 13:38, David Bovill wrote:
> Anyone got any suggestions / experience in using htmltext to store data /
> metadata. Most of the time is strips out any additional tags you might add
> (which is a great pity) - but I've found it useful to use markup like:
> <a name="some thing you want to store">For this text</a>
> Are there any other tags that can be used to markup text with metadata?


A technique I used a few years ago, which worked out well, was to use the 
low-order bits of the colour to code an ID that my code could associate with 
whatever it liked.  By reserving two bits each from R/G/B one immediately gets 
an ID space of 128, and I doubt if any user could tell the difference in the 
colour of the text.  An advantage of using the colour in this way is that it 
is independent of other text attributes such as style, font, size etc; and 
that as the user edits, it adjusts naturally.  It did depend on the fact that 
in this context my app had complete control over the styling of the text: any 
changes the user made, other than typing, went through my code, so that for 
example if text was linked, my code could preserve the low-order bits of the 
colour as the text changed from 'black' to 'blue'; and when text was pasted, 
again my code had to step in to fiddle with colours.  But as I say it was a 
very satisfactory solution.

However I do recall that last time I mentioned it on a Rev list someone had 
what sounded like a far superior and simpler technique!  But I offer it for 
what it's worth.


More information about the Use-livecode mailing list