<blockquote><font class="small">posted by Dave_L:</font><hr /> So should that be considered a bug? <hr /></blockquote><br /><br /><br />Actually that's a "designed flaw"... lol This was the way Rick was able to deal with the new color markup code.<br /><br />Perhaps one can still simply replace the </font color> tags with </font> tags before displaying so that they are compliant?
Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
That sounds like it would work, except that the translation would have to be done every time a post is displayed, which seems inefficient.<br /><br />A couple of other choices:<br /><br />Use the method employed by UBB.classic, where the opening and closing tags are translated with a single regex.<br /><br />Use <!--color--></font> in place of </font color>. I haven't thought this through, so I'm not sure if it would work.
_________________________
UBB.threads beta tester / threadsdev.com moderator Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.
Gardener
Addict
Registered: 05/11/99
Posts: 1956
Loc: Sweden, Uppsala
[]<br />Actually that's a "designed flaw"... lol This was the way Rick was able to deal with the new color markup code.<br /><br />Perhaps one can still simply replace the </font color> tags with </font> tags before displaying so that they are compliant? <hr /></blockquote><br /><br />Yes, it should be possible. I've been thinking of adding this to the markuphack since there are even more tags that aren't really xhtml compliant in the same way.
Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
I don't think that would work, because there may be other </font> tags that don't correspond to the color markups. (Unless the UBB.classic method were used.)
_________________________
UBB.threads beta tester / threadsdev.com moderator Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.
<blockquote><font class="small">posted by Gardener:</font><hr /> Other markup tags also have the </font> tag so the undo_markup function won't be able to distinguish which one is used for the color tag.<hr /></blockquote> <br /> <br />undo_markup could easily tell which closing font tags are used for color tags because they are the ones that follow a font tag with a <br />color attribute. I haven't seen the latest markup code but this is the way to do it (with perl): <br /> <br /><pre><font class="small">code:</font><hr> <br />$Body =~ s/\[$lang{'COLOR_RED'}\](.*?)\[\/$lang{'COLOR_RED'}\]/<font color=red>$1<\/font>/ig; # do <br />$Body =~ s/<font color=red>(.*?)<\/font>/\[$lang{'COLOR_RED'}\]$1\[\/$lang{'COLOR_RED'}\]/ig; # undo <br /></pre><hr> <br />
Gardener
Addict
Registered: 05/11/99
Posts: 1956
Loc: Sweden, Uppsala
Won't work.<br /><br />Well, it will, but start nesting tags and it will break. That's the reason the start and end font tag is replaced separately and the reason that the </font> has the extra info so that it differs from other </font> tags.
Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
Actually, mod_perl's post describes the method used by UBB.classic that I referred to earlier. Nested tags are handled properly if you loop over the regex replacement operations. Each loop iteration handles one layer of nesting.
_________________________
UBB.threads beta tester / threadsdev.com moderator Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.
Gardener
Addict
Registered: 05/11/99
Posts: 1956
Loc: Sweden, Uppsala
Granted, with added code, the code would work. =] Sort of, at least. There would still be problems with extra tags inside the color tag that would also use the </font> right? Because that would match first.
Gardener
Addict
Registered: 05/11/99
Posts: 1956
Loc: Sweden, Uppsala
More tags than the color-tag could generate the </font> end tag, and when parsing the color tag those tags would match as well.<br /><br />If these tags were used:<br />[font:courier] [color:red] [size:5] Red courier, size 5 [/size] [/color] [/font]<br /><br />And it would create the following html:<br /><font style="courier"><font color="red"><font size="5"> Red courier, size 5 </font></font></font><br /><br />Then the regexp would parse the code like this:<br />[font:courier][color:red][size:5] Red courier, size 5 [/font][/color][/size]<br /><br />Because the regex would match the first occurance of </font>. In the above example, the tags are just nested wrong, but it could match other code which would break things even worse. Like </font> which is inside the quote-tag if I'm not mistaken.