Span Tags in HTML

David Bovill david at openpartnership.net
Tue Feb 10 06:40:34 CST 2009


2009/2/10 Ray Horsley <Ray at linkit.com>

> Thanks Brian but I'm afraid including the <body> tags doesn't render
> anything either.  I've also tried including a document declaration as in the
> example below but I'm still getting nothing rendered.  (That's the trouble
> when working with externals.  You can't open them up to see what's going
> on.)
> Any other ideas are welcome.
>

Hi Ray - did a bit of work on this recently. AFAIK the only way is to
process the raw html, and create your own htmltext. Here are the handlers
I've got so far:

--> HTML | Span
> -
> /* Strip span tags
> These functions replace html span tags such as those found in basic html /
> jabber / im html with tags for rev htmltext
> */
>
> function html_BasicToRev someHtml
>     put html_BoldSpanToRev(someHtml) into someHtml
>     put html_ColourSpanToRev(someHtml) into someHtml
>     return someHtml
> end html_BasicToRev
>
> function html_RevToBasic someHtmlText
>     put html_RevToColourSpan(someHtmlText) into someHtml
>     return html_RevToBoldSpan(someHtml)
> end html_RevToBasic
>
> function html_RevToColourSpan someHtml
>     replace quote with "'" in someHtml
>     put "(?miU)(<font color=').*(</font>)" into someReg
>     repeat
>         if matchchunk(someHtml, someReg, oTagStart, oTagEnd, cTagStart,
> cTagEnd) is true then
>             put "</span>" into char cTagStart to cTagEnd of someHtml
>             put "<span style='color:" into char oTagStart to oTagEnd of
> someHtml
>         else
>             replace quote with "'" in someHtml
>             return someHtml
>         end if
>     end repeat
> end html_RevToColourSpan
>
> function html_RevToBoldSpan someHtml
>     put "(?miU)(<b>).*(</b>)" into someReg
>     -- put "(?mi)(<b>)[^\<]*(</b>)" into someReg
>     repeat
>         if matchchunk(someHtml, someReg, oTagStart, oTagEnd, cTagStart,
> cTagEnd) is true then
>             put "</span>" into char cTagStart to cTagEnd of someHtml
>             put "<span style='font-weight:bold'>" into char oTagStart to
> oTagEnd of someHtml
>         else
>             return someHtml
>         end if
>     end repeat
> end html_RevToBoldSpan
>
> function html_ColourSpanToRev someHtml
>     -- U is for non-greedy
>     replace quote with "'" in someHtml
>     put "(?miU)(<span style='color:).*(</span>)" into someReg
>     -- put "(?mi)(<span style='color:)[^\<]*(</span>)" into someReg
>     repeat
>         if matchchunk(someHtml, someReg, oTagStart, oTagEnd, cTagStart,
> cTagEnd) is true then
>             put "</font>" into char cTagStart to cTagEnd of someHtml
>             put "<font color='" into char oTagStart to oTagEnd of someHtml
>         else
>             replace "'" with quote in someHtml
>             return someHtml
>         end if
>     end repeat
> end html_ColourSpanToRev
>
> function html_BoldSpanToRev someHtml
>     put "(?miU)(<span style='font-weight:bold'>).*(</span>)" into someReg
>     -- put "(?mi)(<span style='font-weight:bold'>)[^\<]*(</span>)" into
> someReg
>     repeat
>         if matchchunk(someHtml, someReg, oTagStart, oTagEnd, cTagStart,
> cTagEnd) is true then
>             put "</b>" into char cTagStart to cTagEnd of someHtml
>             put "<b>" into char oTagStart to oTagEnd of someHtml
>         else
>             return someHtml
>         end if
>     end repeat
> end html_BoldSpanToRev
>

If you improve them do post back. I'm interested in getting robust two way
html "<span>" to rev htmltext based style sheets working :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.runrev.com/pipermail/metacard/attachments/20090210/712063c5/attachment.html


More information about the metacard mailing list