PR: MNG-706

Submitted by: Siveton Vincent
Reviewed by:  Emmanuel Venisse
Comment: Correct the API to handle correctly the javadoc as HTML; Updated getValidHref() to handle relative path.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-09-26 16:41:53 +00:00
parent eaf9a7ef0e
commit c6a140e1ae
1 changed files with 38 additions and 4 deletions

View File

@ -189,10 +189,29 @@ public abstract class AbstractMavenReportRenderer
* @see #linkPatternedText(String) * @see #linkPatternedText(String)
*/ */
protected void tableCell( String text ) protected void tableCell( String text )
{
tableCell( text, false );
}
/**
* Add a cell in a table.
* <p>If <code>asHtml</code> is true, add the text as Html</p>
*
* @param text
* @param asHtml
*/
protected void tableCell( String text, boolean asHtml )
{ {
sink.tableCell(); sink.tableCell();
if ( asHtml )
{
sink.rawText( text );
}
else
{
linkPatternedText( text ); linkPatternedText( text );
}
sink.tableCell_(); sink.tableCell_();
} }
@ -224,7 +243,9 @@ public abstract class AbstractMavenReportRenderer
protected void tableCaption( String caption ) protected void tableCaption( String caption )
{ {
sink.tableCaption(); sink.tableCaption();
text( caption ); text( caption );
sink.tableCaption_(); sink.tableCaption_();
} }
@ -422,7 +443,8 @@ public abstract class AbstractMavenReportRenderer
/** /**
* Return a valid href. * Return a valid href.
* <p>A valid href could start by <code>mailto:</code></p>. * <p>A valid href could start by <code>mailto:</code>.</p>
* <p>For a relative path, the href should start by <code>./</code> to be valid.</p>
* *
* @param href an href * @param href an href
* @return a valid href or null if the href is not valid. * @return a valid href or null if the href is not valid.
@ -451,7 +473,7 @@ public abstract class AbstractMavenReportRenderer
// TODO Waiting for new release of Validator // TODO Waiting for new release of Validator
// http://issues.apache.org/bugzilla/show_bug.cgi?id=30686 // http://issues.apache.org/bugzilla/show_bug.cgi?id=30686
String hrefTmp; String hrefTmp;
if ( !href.trim().endsWith( "/" ) ) if ( !href.endsWith( "/" ) )
{ {
hrefTmp = href + "/index.html"; hrefTmp = href + "/index.html";
} }
@ -465,6 +487,18 @@ public abstract class AbstractMavenReportRenderer
return href; return href;
} }
if ( href.startsWith( "./" ) )
{
if ( href.length() > 2 )
{
return href.substring(2, href.length() );
}
else
{
return ".";
}
}
return null; return null;
} }
} }