Item name is always displayed even if img attribute is setted. In the navigation file the new attribute 'hideName' can be used to hide the name in the link (if you want to display only the image for example).

An image can be used in the menu entry for a report.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@386905 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier 2006-03-19 00:19:09 +00:00
parent 236ab1a6b0
commit a634b0e4fd
9 changed files with 40 additions and 11 deletions

View File

@ -61,6 +61,7 @@
@fileSuffix the file suffix to add to the link ('.html' by default)
@externalLink the nav-bar link for this report
@target the target for the new page (_self, _blank, ...)
@image an image to display in the link generated in the reports list
-->
<maven:get var="reports" plugin="maven-xdoc-plugin" property="reports" />
@ -82,6 +83,7 @@
${report.put('fileSuffix', fileSuffix)}
${report.put('externalLink', externalLink)}
${report.put('target', target)}
${report.put('image', image)}
${reports.add(report)}
</j:set>
</j:if>
@ -192,6 +194,7 @@
@img
@state - expanded / collapsed / none
@target
@hideName set it to true to hide the link name (can be use to display only the image)
-->
<define:tag name="itemLink">
<j:catch>
@ -218,8 +221,7 @@
<x:attribute name="target">${target}</x:attribute>
</j:if>
<j:if test="${empty(state)}"><j:set var="state" value="none"/></j:if>
<j:if test="${empty(img)}">${name}</j:if>
<j:if test="${!empty(img)}"><img style="border: 1px" src="${pathTool.calculateLink(img, relativePath)}" title="${name}" alt="${name}"/></j:if>
<j:if test="${!empty(img)}"><img class="imageLink" src="${pathTool.calculateLink(img, relativePath)}" title="${name}" alt="${name}"/></j:if><j:if test="${empty(hideName) or hideName!=true}">${name}</j:if>
</x:element>
</define:tag>

View File

@ -154,3 +154,11 @@ div.clear hr{
margin: 0px;
padding: 0px;
}
#navcolumn img.imageLink, .imageLink{
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
padding-right: 2px;
border: 0px;
margin: 0px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 B

View File

@ -82,12 +82,14 @@
</j:if>
<item name="${report.name}"
href="/${link}${fileSuffix}"
target="${report.target}" />
target="${report.target}"
img="${report.image}"/>
</j:if>
<j:if test="${empty(link) and !empty(externalLink)}">
<item name="${report.name}"
href="${externalLink}"
target="${report.target}" />
target="${report.target}"
img="${report.image}"/>
</j:if>
</j:forEach>
</item>

View File

@ -673,13 +673,14 @@
<x:set var="_name" select="string(@name)"/>
<x:set var="_link" select="string(@href)"/>
<x:set var="_target" select="string(@target)"/>
<x:set var="_hideName" select="string(@hideName)"/>
<j:whitespace trim="false">
<j:if test="${linkCount != 1}">
<j:if test="${!(maven.xdoc.crumb.separator == '')}">
<span class="separator">${maven.xdoc.crumb.separator}</span>
</j:if>
</j:if>
<doc:itemLink name="${_name}" link="${_link}" img="${_img}" target="${_target}"/>
<doc:itemLink name="${_name}" link="${_link}" img="${_img}" target="${_target}" hideName="${_hideName}"/>
</j:whitespace>
<j:set var="linkCount" value="${1+linkCount}"/>
</x:forEach>
@ -692,8 +693,9 @@
<x:set var="_name" select="string(@name)"/>
<x:set var="_link" select="string(@href)"/>
<x:set var="_target" select="string(@target)"/>
<x:set var="_hideName" select="string(@hideName)"/>
<j:whitespace trim="false">
<doc:itemLink name="${_name}" link="${_link}" img="${_img}" target="${_target}"/>&#160;<span class="separator">&gt;</span>
<doc:itemLink name="${_name}" link="${_link}" img="${_img}" target="${_target}" hideName="${_hideName}"/>&#160;<span class="separator">&gt;</span>
</j:whitespace>
</x:forEach>
</jsl:template>
@ -742,6 +744,7 @@
<x:set var="_link" select="string(@href)"/>
<x:set var="_img" select="string(@img)"/>
<x:set var="_target" select="string(@target)"/>
<x:set var="_hideName" select="string(@hideName)"/>
<x:set var="_childCount" select="count(./item)"/>
<j:set var="_isCollapsed" value="${navbean.isCollapsed(item.get(0))}"/>
<j:set var="_state" value="none"/>
@ -771,10 +774,10 @@
</j:if>
<li class="${_state}">
<j:if test="${navbean.isSelected(item.get(0))}">
<strong><doc:itemLink name="${_name}" link="${_link}" img="${_img}" state="${_state}" target="${_target}"/></strong>
<strong><doc:itemLink name="${_name}" link="${_link}" img="${_img}" state="${_state}" target="${_target}" hideName="${_hideName}"/></strong>
</j:if>
<j:if test="${!navbean.isSelected(item.get(0))}">
<doc:itemLink name="${_name}" link="${_link}" img="${_img}" state="${_state}" target="${_target}"/>
<doc:itemLink name="${_name}" link="${_link}" img="${_img}" state="${_state}" target="${_target}" hideName="${_hideName}"/>
</j:if>
<j:if test="${_state == 'expanded'}">
<ul>

View File

@ -97,6 +97,7 @@
<xs:attribute name="target" type="xs:string"/>
<xs:attribute name="img" type="xs:string"/>
<!-- img is an href that will be used as the image for link -->
<xs:attribute name="hideName" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -97,6 +97,7 @@
<xs:attribute name="target" type="xs:string"/>
<xs:attribute name="img" type="xs:string"/>
<!-- img is an href that will be used as the image for link -->
<xs:attribute name="hideName" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -27,6 +27,8 @@
</properties>
<body>
<release version="1.10-SNAPSHOT" date="in SVN">
<action dev="aheritier" type="update">An image can be used in the menu entry for a report.</action>
<action dev="aheritier" type="update">Item name is always displayed even if img attribute is setted. In the navigation file the new attribute 'hideName' can be used to hide the name in the link (if you want to display only the image for example).</action>
<action dev="aheritier" type="add">Allow the use of items' attributes 'target' and 'img' for breadcrumbs entries in the navigation file.</action>
<action dev="aheritier" type="update">In breadcrumbs, use for the project's name nav.title if defined, pom.name otherwise.</action>
<action dev="aheritier" type="fix">Display the "external link" icon only if the link host is different from the project url (pom.url).</action>

View File

@ -76,6 +76,11 @@
<td>Yes</td>
<td>The target for the new page (_self, _blank, ...).</td>
</tr>
<tr>
<td>image</td>
<td>Yes</td>
<td>The link to an image to display in the report entry in the navigation bar. This link must be relative to the root directory of the documentation.</td>
</tr>
</table>
</subsection>
<subsection name="formatAsNumber Tag">
@ -183,7 +188,7 @@
</table>
</subsection>
<subsection name="itemLink Tag">
<p>Used to generate the links in the navigation bar.</p>
<p>Used to generate the links in the navigation bar, the breadcrumbs and the quick links.</p>
<table>
<tr><th>Attribute</th><th>Optional?</th><th>Description</th></tr>
<tr>
@ -204,7 +209,12 @@
<tr>
<td>img</td>
<td>Yes</td>
<td>An optional image to display instead of the link name.</td>
<td>An optional image to display in addition to the name.</td>
</tr>
<tr>
<td>hideName</td>
<td>Yes</td>
<td>Set to true to hide the link's name (can be used to only display the image for example).</td>
</tr>
<tr>
<td>state</td>
@ -214,7 +224,7 @@
<tr>
<td>target</td>
<td>Yes</td>
<td></td>
<td>The same as in HTML. Used with frames to specify in which frame the link should be rendered. If <code>_blank</code> is used, an icon is displayed to show that a new window is opened by clicking on this link.</td>
</tr>
</table>
</subsection>