sub TrackLinks()

in d3d/archive/images/d3d11/postproc.pl [405:446]


    sub TrackLinks
    {
        my $attr = shift;
        # Store link defined link destinations and expected link definitions in a couple of tables.
        # Later we can make sure there are no broken links.
        foreach $key (keys(%$attr)) {
            if( uc($key) eq "ID" ) 
            {
                if( $attr->{$key} =~ /#?(.*)/ )
                {
                    if(undef!=$DefinedLinkDestinations{$1})
                    {
                        $MessageCount++;
                        $Messages .= "(".$MessageCount.") Error: Link target \"$1\" defined multiple times!\n\n";
                    }
                    if( $InHeader )
                    {
                        GetSectionNumber( $InHeader ); # compute section number
                    } # else we are in the body of a section
                    $DefinedLinkDestinations{$1} = GetLastSectionNumber; # unpadded section number
                }
            }
            else
            {
                if( uc($key) eq "HREF" )
                {
                    if( $attr->{$key} =~ /^\#(.*)/ ) #Is the link preceded by the '#' character?
                    {
                        if( undef eq $ExpectedLinkDestinations{$1} )
                        {
                            $ExpectedLinkDestinations{$1} = 1;
                        }
                    }
                    else
                    {
                        $DefinedLinkDestinations{$attr->{$key}} = "outside link";
                        $ExpectedOutsideLinkDeclarations{$attr->{$key}} = 1;                        
                    }                                       
                }
            }
        }
    }