From c6a140e1ae9c0d65824fe91b46e1663c5404cf1b Mon Sep 17 00:00:00 2001 From: Emmanuel Venisse Date: Mon, 26 Sep 2005 16:41:53 +0000 Subject: [PATCH] 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 --- .../AbstractMavenReportRenderer.java | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java b/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java index 9c928f0bde..bbbcea7eb6 100644 --- a/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java +++ b/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java @@ -189,10 +189,29 @@ public abstract class AbstractMavenReportRenderer * @see #linkPatternedText(String) */ protected void tableCell( String text ) + { + tableCell( text, false ); + } + + /** + * Add a cell in a table. + *

If asHtml is true, add the text as Html

+ * + * @param text + * @param asHtml + */ + protected void tableCell( String text, boolean asHtml ) { sink.tableCell(); - linkPatternedText( text ); + if ( asHtml ) + { + sink.rawText( text ); + } + else + { + linkPatternedText( text ); + } sink.tableCell_(); } @@ -224,7 +243,9 @@ public abstract class AbstractMavenReportRenderer protected void tableCaption( String caption ) { sink.tableCaption(); + text( caption ); + sink.tableCaption_(); } @@ -422,7 +443,8 @@ public abstract class AbstractMavenReportRenderer /** * Return a valid href. - *

A valid href could start by mailto:

. + *

A valid href could start by mailto:.

+ *

For a relative path, the href should start by ./ to be valid.

* * @param href an href * @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 // http://issues.apache.org/bugzilla/show_bug.cgi?id=30686 String hrefTmp; - if ( !href.trim().endsWith( "/" ) ) + if ( !href.endsWith( "/" ) ) { hrefTmp = href + "/index.html"; } @@ -465,6 +487,18 @@ public abstract class AbstractMavenReportRenderer return href; } + if ( href.startsWith( "./" ) ) + { + if ( href.length() > 2 ) + { + return href.substring(2, href.length() ); + } + else + { + return "."; + } + } + return null; } } @@ -484,7 +518,7 @@ public abstract class AbstractMavenReportRenderer } // Map defined by key/value name/href - // If href == null, it means + // If href == null, it means Map segments = new LinkedHashMap(); // TODO Special case http://jira.codehaus.org/browse/MEV-40