<< Anyone have a reliable means of generating browser-compliant HTML from MC? 
>>

Yes: don't use htmlText. Actually, I've never even tried using the htmlText 
property- I hand-code my templates which I store in fields as raw HTML. But 
it certainly would be easier if I could just style my fields and rely on 
htmlText for the conversion. Perhaps the easiest runaround right now would be 
a getprop handler which used a base font size and converted everything to 
relative sizes? What about something roughly like this:
(not tested, not efficient?)

<PRE>

getprop relativeHtmlText

    put the baseFontSize of the target into baseSize
    if (baseSize is empty) then put 12 into baseSize

    put the htmlText of the target into theText

    put 0 into startOffset
    put 1 into theOffset

    repeat
        ## find FONT tag
        put offset("<FONT SIZE=", theText, startOffset) into theOffset
        if (theOffset = 0) then exit repeat
        add startOffset to theOffset

        ## find beginning and end of SIZE attribute
        put theOffset+11 into startSize
        put offset(" ", theText, startSize) into endSize
        if (endSize = 0) then exit repeat
        add startSize to endSize

        put char startSize to (endSize - 1) of theText into fontSize
        if (fontSize is a number) then
            ## replace all occurences at once
            put round(fontSize*100/baseSize)&"%" into relativeFontSize
            replace "<FONT SIZE="&fontSize&space with "<FONT 
SIZE="&relativeFontSize&space in theText
        end if

        ## skip over this tag for next iteration
        put startSize + length(relativeFontSize) into startOffset
    end repeat
end relativeHtmlText

</PRE>

Regards,
Brian

Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to