You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by bo...@werken.com on 2003/02/21 11:52:15 UTC
[maven-bug] New comment: (MAVEN-283) navigation generates invalid relative links
The following comment has been added to this issue:
Author: Rafal Krzewski
Created: Fri, 21 Feb 2003 4:52 AM
Body:
The current code for resolving relative links in xdoc plugin's plugin.jelly file looks like that:
<define:tag name="itemLink">
<j:set var="leaveLinkAlone" value="${(link.indexOf(':') >= 0) or link.startsWith('/site')}"/>
<j:if test="${leaveLinkAlone}">
<a href="${link}">${name}</a>
</j:if>
<j:if test="${!leaveLinkAlone}">
<a href="${relativePath}${link}">${name}</a>
</j:if>
</define:tag>
I believe that this is not correct. It treats links that begin with a
/ (but not /site -- WTH?) as relative, and hapilly prepends a . to the
links that do not begin with a / producing an incorrect links. The
correct code, in my opinion looks like that:
<define:tag name="itemLink">
<j:set var="leaveLinkAlone" value="${(link.indexOf(':') >= 0) or link.startsWith('/')}"/>
<j:if test="${leaveLinkAlone}">
<a href="${link}">${name}</a>
</j:if>
<j:if test="${!leaveLinkAlone}">
<j:if test="${relativePath.equals(".")}">
<a href="${link}">${name}</a>
</j:if>
<j:if test="${relativePath.endsWith('/')}">
<a href="${relativePath}${link}">${name}</a>
</j:if>
<j:if test="${!relativePath.endsWith('/')}">
<a href="${relativePath}/${link}">${name}</a>
</j:if>
</j:if>
</define:tag>
I'm attaching a patch, and mailing it to Ben, just in case.
---------------------------------------------------------------------
View the issue:
http://jira.werken.com/secure/ViewIssue.jspa?key=MAVEN-283
Here is an overview of the issue:
---------------------------------------------------------------------
Key: MAVEN-283
Summary: navigation generates invalid relative links
Type: Bug
Status: In Progress
Priority: Major
Time Spent: Unknown
Estimate: 0 minutes
Project: maven
Component: None
Assignee: Ben Walding
Reporter: Rafal Krzewski
Created: Tue, 18 Feb 2003 10:12 AM
Updated: Wed, 19 Feb 2003 4:09 PM
Environment: J2SDK 1.4.1, Linux
Description:
<body>
<links>
<item name="labeo" href="../index.html"/>
<item name="labeo-base" href="../labeo-base/index.html"/>
</links>
</body>
Results in the following content being generated:
<a href=".
../labeo-base/index.html
">
labeo-base
</a>
|
<a href=".
../labeo-optional/index.html
">
labeo-optioanl
</a>
Expected output would be:
<a href="../labeo-base/index.html">
labeo-base
</a>
or, more realisitcally
<a href="./../labeo-base/index.html">
labeo-base
</a>
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.werken.com/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira