private void generateDetailsSection()

in src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java [380:519]


    private void generateDetailsSection( Locale locale, LinkcheckModel linkcheckModel, Sink sink )
    {
        sink.section1();
        sink.sectionTitle1();
        sink.text( i18n.getString( "linkcheck-report", locale, "report.linkcheck.detail" ) );
        sink.sectionTitle1_();

        sink.paragraph();
        sink.rawText( i18n.getString( "linkcheck-report", locale, "report.linkcheck.detail.overview" ) );
        sink.paragraph_();

        sink.table();

        // Header
        generateTableHeader( locale, true, sink );

        // Content
        List linkcheckFiles = linkcheckModel.getFiles();
        for ( Object linkcheckFile1 : linkcheckFiles )
        {
            LinkcheckFile linkcheckFile = (LinkcheckFile) linkcheckFile1;

            sink.tableRow();

            sink.tableCell();
            if ( linkcheckFile.getUnsuccessful() == 0 )
            {
                iconValid( locale, sink );
            }
            else
            {
                iconError( locale, sink );
            }
            sink.tableCell_();

            // tableCell( createLinkPatternedText( linkcheckFile.getRelativePath(), "./"
            // + linkcheckFile.getRelativePath() ) );
            sink.tableCell();
            sink.link( linkcheckFile.getRelativePath() );
            sink.text( linkcheckFile.getRelativePath() );
            sink.link_();
            sink.tableCell_();
            sink.tableCell();
            sink.text( String.valueOf( linkcheckFile.getNumberOfLinks() ) );
            sink.tableCell_();
            sink.tableCell();
            sink.text( String.valueOf( linkcheckFile.getNumberOfLinks( LinkcheckFileResult.VALID_LEVEL ) ) );
            sink.tableCell_();
            sink.tableCell();
            sink.text( String.valueOf( linkcheckFile.getNumberOfLinks( LinkcheckFileResult.WARNING_LEVEL ) ) );
            sink.tableCell_();
            sink.tableCell();
            sink.text( String.valueOf( linkcheckFile.getNumberOfLinks( LinkcheckFileResult.ERROR_LEVEL ) ) );
            sink.tableCell_();

            sink.tableRow_();

            // Detail error
            if ( linkcheckFile.getUnsuccessful() != 0 )
            {
                sink.tableRow();

                sink.tableCell();
                sink.text( "" );
                sink.tableCell_();

                // TODO it is due to DOXIA-78
                sink.rawText( "<td colspan=\"5\">" );

                sink.table();

                for ( Object o : linkcheckFile.getResults() )
                {
                    LinkcheckFileResult linkcheckFileResult = (LinkcheckFileResult) o;

                    if ( linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.VALID_LEVEL )
                    {
                        continue;
                    }

                    sink.tableRow();

                    sink.tableCell();
                    if ( linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.WARNING_LEVEL )
                    {
                        iconWarning( locale, sink );
                    }
                    else if ( linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.ERROR_LEVEL )
                    {
                        iconError( locale, sink );
                    }
                    sink.tableCell_();

                    sink.tableCell();
                    sink.italic();
                    if ( linkcheckFileResult.getTarget().startsWith( "#" ) )
                    {
                        sink.link( linkcheckFile.getRelativePath() + linkcheckFileResult.getTarget() );
                    }
                    else if ( linkcheckFileResult.getTarget().startsWith( "." ) )
                    {
                        // We need to calculate a correct absolute path here, because target is a relative path
                        String absolutePath =
                            FilenameUtils.getFullPath( linkcheckFile.getRelativePath() )
                                + linkcheckFileResult.getTarget();
                        String normalizedPath = FilenameUtils.normalize( absolutePath );
                        if ( normalizedPath == null )
                        {
                            normalizedPath = absolutePath;
                        }
                        sink.link( normalizedPath );
                    }
                    else
                    {
                        sink.link( linkcheckFileResult.getTarget() );
                    }
                    // Show the link as it was written to make it easy for
                    // the author to find it in the source document
                    sink.text( linkcheckFileResult.getTarget() );
                    sink.link_();
                    sink.text( ": " );
                    sink.text( linkcheckFileResult.getErrorMessage() );
                    sink.italic_();
                    sink.tableCell_();

                    sink.tableRow_();
                }

                sink.table_();

                sink.tableCell_();

                sink.tableRow_();
            }
        }

        sink.table_();

        sink.section1_();
    }