#160 variables span or class yeild nested tag ugliness

closed-fixed
Andre-Littoz
5
2011-03-12
2010-10-18
Marc W. Mengel
No

If you cross-reference C code that has variable "span" the markup engine first puts
<span class='reserved'>typedef</span>
and then the identifier markup turns that into
<<a href="...ident?i=span">span</a> class='reserved'>typedef</span>

If you have a program with all 3 of "span", "class" and "reserved" as variables, the results are particualrly special.

I've worked around this somewhat by hacking up Generic.pm with the following patch, but there are still a few
such instances leaking through...
*** Generic.pm.orig 2010-09-27 11:35:23.000000000 -0500
--- Generic.pm 2010-10-17 13:09:59.000000000 -0500
***************
*** 155,168 ****

$self->processreserved($code);

! # Replace identifier by link unless it's a reserved word
$$code =~
s{
! (^|[^\$\w\#])([-\w~\#][\w]*)\b
}
{
$1.
! ( $index->issymbol($2, $$self{'releaseid'}) ? join($2, @{$$self{'itag'}}) : $2 );
}gex;
}

--- 155,168 ----

$self->processreserved($code);

! # Replace identifier by link unless it's a reserved word or part of a span tag from above...
$$code =~
s{
! ((?:\s*<span.*?>.*?</span>\s*)+|[^\$\w\#]|^)([-\w~\#]?[\w]*)\b
}
{
$1.
! ((! $self->isreserved($2) && $index->issymbol($2, $$self{'releaseid'})) ? join($2, @{$$self{'itag'}}) : $2 );
}gex;
}

Discussion

  • Marc W. Mengel
    Marc W. Mengel
    2010-10-18

    span class variable fix

     
    Attachments
  • Marc W. Mengel
    Marc W. Mengel
    2010-10-18

    Attached a patch which seems to work reliably now.

     
  • Andre-Littoz
    Andre-Littoz
    2011-03-04

    The same behaviour happens with processinclude if filename looks like a reserved word or contains a pathological variable like above. Thus it deserves the same kind of correction.

    As you noticed, your proposed patch leaves some leaks. I tackled the issue on a different principle: in my opinion, the cause is the multi-pass nature of the replacements/taggings. All must be done simultaneously to prevent the mis-behaviour.

    Take a look to the help forum where I posted the whole bunch of my patches under topic 'Help on non regression' as I'd like someone to check these on different data than mine.

    Regards,

    Pat

     
  • Andre-Littoz
    Andre-Littoz
    2011-03-12

    • assigned_to: nobody --> ajlittoz
     
  • Andre-Littoz
    Andre-Littoz
    2011-03-12

    • status: open --> closed-fixed
     
  • Andre-Littoz
    Andre-Littoz
    2011-03-12

    This has now been fixed in CVS.

    If you can install the new version and check that it solves your
    problem, then it would be very useful.

    Thanks for reporting this defect and helping to make LXR better.

     
  • Andre-Littoz
    Andre-Littoz
    2011-03-12

    To allow for more future processing on identifiers, transformed two-pass process (where result of first process gets rescanned by second process, leading to eventual marking of HTML tags) in single-pass process with switch-like routing to appropriate transformation.