Gay But Not Narrow (ruakh) wrote in lj_dev,
Gay But Not Narrow
ruakh
lj_dev

Error in cleanhtml.pl?

cleanhtml.pl contains the following code:
# if (the current HTML token is a start-tag) {
            my $slashclose = 0;   # If set to 1, use XML-style empty tag marker
            
            # for tags like <name/>, pretend it's <name> and reinsert the slash later
            $slashclose = 1 if ($tag =~ s!/$!!);
# . . .
#           if ($tag eq "lj-raw") 
            {
                # Strip it out, but still register it as being open
                $opencount{$tag}++;
            }
#           if (the tag isn't an LJ-specific tag) {
                $slashclose = 1 if delete $hash->{'/'};
#           }
# . . .
#           if (we're going to send the tag to output) {
                        if ($slashclose) {
                            $newdata .= " /";
                            $opencount{$tag}--;
                        }
                        if ($allow) { 
			    $newdata .= ">"; 
			    $opencount{$tag}++;
			}
#           }
# }
The code seems to me to be saying that a tag like <code /> should result in $opencount{'code'} being decremented. That seems wrong; $opencount{'code'} should be neither incremented nor decremented, right? (The code seems to think that $opencount{'code'} is already getting incremented somewhere, so it should now decrement it; but that doesn't seem to me to be the case.)

Am I wrong, or is this an error in cleanhtml.pl? Thanks for any input!
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment