Span Tags in HTML
Ray Horsley
Ray at LinkIt.Com
Tue Feb 10 11:23:01 CST 2009
David,
Thanks for the functions! I'll send you some if I go this route and
write any of my own. I just can't believe that the RevBrowser
external doesn't allow for the rending of a local html doc passed
through.
Ray Horsley
LinkIt! Sofware
On Feb 10, 2009, at 4:40 AM, David Bovill wrote:
>
>
> 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 :)
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.runrev.com/pipermail/metacard/attachments/20090210/05ffdeba/attachment.html
More information about the metacard
mailing list