Add a search element to nav courtesy of Tim A.

This is MAVEN-554 with a fix


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113610 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion
2003-07-08 03:47:45 +00:00
parent bbb2d1061e
commit 32c341df60
2 changed files with 31 additions and 1 deletions

View File

@@ -163,7 +163,7 @@
</j:if>
<x:if select="$nav">
<jsl:applyTemplates select="$nav/body/menu[not(@type) | @type='header']"/>
<jsl:applyTemplates select="$nav/body/menu[not(@type) | @type='header'] | $nav/body/search"/>
</x:if>
<!-- Standard Maven Navigation -->
@@ -414,6 +414,32 @@
</x:forEach>
</jsl:template>
<!-- Google site search -->
<jsl:template match="search" trim="false">
<!-- Search code: http://www.google.com/searchcode.html -->
<!-- Google logos: http://www.google.com/stickers.html -->
<!-- Terms: http://www.google.com./services/terms_free.html -->
<div>
<strong>Search ${pom.name}</strong>
<form method="get" action="http://www.google.com/search">
<a class="navlink" href="http://www.google.com">
<img src="http://www.google.com/logos/Logo_25wht.gif"
alt="Google" border="0" />
</a><p/>
<j:set var="siteURL" value="${pom.url}"/>
<!-- google fails on urls that end with / -->
<j:if test="${siteURL.endsWith('/')}">
<j:set var="URLLength" value="${siteURL.length() - 1}"/>
<j:set var="siteURL" value="${siteURL.substring(0, URLLength.intValue())}"/>
</j:if>
<input type="text" size="15" name="q" maxlength="255" value=""/>
<input type="submit" value="Go" name="btnG"/>
<input type="hidden" name="domains" value="${siteURL}"/>
<input type="hidden" id="search" name="sitesearch" value="${siteURL}"/>
</form>
</div>
</jsl:template>
<!-- process a documentation section -->
<jsl:template match="section" trim="false">
<div class="h3">

View File

@@ -43,6 +43,10 @@
</A>
</footer>
]]></source>
<p>
If a <code>search</code> element is found in the <code>navigation.xml</code> body, a search navigation
menu is generated that uses <a href="http://www.google.com">google</a>
</p>
<p>
In addition to xdocs, users may wish to include other types of
files such as images, their own HTML files, PDFs, etc. By