You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by md...@apache.org on 2004/02/17 00:26:32 UTC

cvs commit: jakarta-commons/commons-build commons-site.jsl project.properties

mdiggory    2004/02/16 15:26:32

  Modified:    commons-build project.properties
  Added:       commons-build commons-site.jsl
  Log:
  Theme'd Maven style without needing to upgrade xdoc plugin.
  
  Revision  Changes    Path
  1.3       +5 -1      jakarta-commons/commons-build/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/commons-build/project.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.properties	16 Feb 2004 19:00:43 -0000	1.2
  +++ project.properties	16 Feb 2004 23:26:32 -0000	1.3
  @@ -16,3 +16,7 @@
   maven.xdoc.version=${pom.currentVersion}
   maven.xdoc.developmentProcessUrl=http://jakarta.apache.org/commons/charter.html
   maven.xdoc.poweredby.image=maven-feather.png
  +
  +# this jsl provides the basic theme capabilities of the xdoc plugin version 1.5
  +# once maven rc2 is out we can throw this away.
  +maven.xdoc.jsl=${basedir}/commons-site.jsl
  \ No newline at end of file
  
  
  
  1.1                  jakarta-commons/commons-build/commons-site.jsl
  
  Index: commons-site.jsl
  ===================================================================
  <?xml version="1.0"?>
  <!-- stylesheet to be used -->
  <jsl:stylesheet select="$doc"
    xmlns:define="jelly:define"
    xmlns:j="jelly:core"
    xmlns:jsl="jelly:jsl"
    xmlns:log="jelly:log"
    xmlns:util="jelly:util"
    xmlns:x="jelly:xml"
    xmlns:doc="doc"
    xmlns:maven="jelly:maven"
    xmlns="dummy"
    trim="true">
    <jsl:template match="document" trim="true">
      <j:useBean var="navbean" class="org.apache.maven.NavBean"/>
  	<j:set var="location" value="${outFile.substring(destdir.length())}"/>
  	<util:replace var="location" oldChar="\" newChar="/" value="${location}"/>
      <!-- Stores location for publish date / version -->
      <j:set var="date">${maven.xdoc.date}</j:set>
  	<j:setProperties object="${navbean}" document="${doc}" location="${location}"/>
  	
      <x:doctype name="html" publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
      <html>
        <head>
          <j:set var="docTitle"><x:expr select="./properties/title"/></j:set>
          <x:if select="$nav/title">
            <title><x:expr select="$nav/title"/> - ${docTitle}</title>
          </x:if>
          <x:if select="not($nav/title)">
            <title>${pom.name} - ${docTitle}</title>
          </x:if>
          
          <j:set var="themeUrl" value="${maven.xdoc.theme.url}"/>
          <util:file var="projectCssFile" name="${maven.docs.src}/style/project.css"/>
          
          <style type="text/css" media="all"><![CDATA[
            @import url("${relativePath}/style/maven-base.css");
            ]]>
  			    <j:if test="${!empty(themeUrl)}"><![CDATA[
  				    @import url("${maven.xdoc.theme.url}");
  			    ]]></j:if>
  			    <j:if test="${empty(themeUrl)}"><![CDATA[
  				    @import url("${relativePath}/style/maven-theme.css");
  			    ]]></j:if>
  			    <j:if test="${projectCssFile.exists()}"><![CDATA[
  				    @import url("${relativePath}/style/project.css");
  			    ]]></j:if>
          </style>
          
          <link rel="stylesheet" type="text/css" href="${relativePath}/style/print.css" media="print"/>
  
          <meta http-equiv="Content-Type" content="text/html; charset=${outputencoding}"/>
          <x:forEach var="author" select="./properties/author">
            <meta name="author" content="${author.text}"/>
            <meta name="email" content="${author.attribute('email').value}"/>
          </x:forEach>
          
          <jsl:applyTemplates select="$doc/document/head/*"/>
          
        </head>
  
        <x:element name="body"><j:whitespace trim="true">
          <x:attribute name="class">composite</x:attribute>
          <x:forEach var="attr" select="$doc/document/body/@*">
            <x:attribute name="${attr.name}">${attr.value}</x:attribute>
          </x:forEach>
          </j:whitespace>
  
          <div id="banner">
                <!-- organization logo -->
                  <j:set var="logo" value="${pom.organization.logo}"/>
                  <j:if test="${!empty(logo)}">
                    <!-- set url to org or project url -->
                    <j:set var="url" value="${pom.organization.url}"/>
                    <j:if test="${!empty(url)}">
                      <j:set var="home" value="${pom.organization.url}"/>
                    </j:if>
                    <j:if test="${empty(url)}">
                      <j:set var="home" value="${pom.url}"/>
                    </j:if>
                    <!-- set image to relative or complete -->
                    <j:set var="image" value="${pom.organization.logo}"/>
                    <j:if test="${!image.startsWith('http://') and !image.startsWith('https://')}">
                      <j:set var="image" value="${relativePath}${image}"/>
                    </j:if>
                    <a href="${home}" id="organizationLogo">
                      <img src="${image}" alt="${pom.organization.name}" />
                    </a>
                  </j:if>
  
                <!-- project logo and link -->
                    <j:set var="logo" value="${pom.logo}"/>
                    <j:if test="${logo != null and logo != ''}">
                      <!-- set image to relative or complete -->
                      <j:set var="image" value="${pom.logo}"/>
                      <j:if test="${!image.startsWith('http://') and !image.startsWith('https://')}">
                        <j:set var="image" value="${relativePath}${image}"/>
                      </j:if>
  
                      <a href="${pom.url}" id="projectLogo">
                        <img src="${image}" alt="${pom.name}"/>
                      </a>
                    </j:if>
                    <j:if test="${logo == null or logo == ''}">
                        <a href="${pom.url}" id="projectLogo">
                          <span>${pom.name}</span>
                        </a>
                    </j:if>
                  <div class="clear"><hr /></div>
          </div>
  
          <div id="breadcrumbs">
                <j:if test="${date == 'left'}">
                  <maven:property var="version" name="maven.xdoc.version" defaultValue="${pom.currentVersion}"/>
                  <div class="xleft">
                  	Last published: ${build.date}
                    <j:if test="${!empty(version)}">| Doc for ${version}</j:if>
                  </div>
                </j:if>
                  <div class="xright">
                    <j:if test="${date == 'right'}">
                      Last published: ${build.date}
                      <x:if select="$nav/body/links">|</x:if>
                    </j:if>
                    <!-- render links -->
                    <x:if select="$nav/body/links">
                      <jsl:applyTemplates select="$nav/body/links"/>
                    </x:if>
                  </div>
                  <div class="clear"><hr /></div>
          </div>
          
          <!-- left column start -->
          <div id="leftColumn">
            <div id="navcolumn">
              <j:if test="${date == 'navigation-top'}">
                <div id="lastPublished">Last published: ${build.date}</div>
              </j:if>
              <x:if select="$nav">
                <jsl:applyTemplates select="$nav/body/menu[not(@type) | @type='header'] | $nav/body/search"/>
              </x:if>
  				    <jsl:applyTemplates select="$projectNav/body/menu"/>
              <!-- allows user to put menu items after standard reports -->
              <x:if select="$nav">
                <jsl:applyTemplates select="$nav/body/menu[@type='footer']"/>
              </x:if>
              <!-- Standard Maven Navigation -->
              <j:set var="fileName">${file}</j:set>
              <j:set var="poweredbyimage">${maven.xdoc.poweredby.image}</j:set>
              <j:set var="poweredbytitle">${maven.xdoc.poweredby.title}</j:set>
              <j:set var="poweredbyurl">${maven.xdoc.poweredby.url}</j:set>
              <j:if test="${!empty(poweredbyimage)}">
                <a id="poweredBy" href="${poweredbyurl}" title="${poweredbytitle}">
                  <img alt="${maven.xdoc.poweredby.title}" src="${relativePath}/images/logos/${poweredbyimage}" />
                </a>
              </j:if>
              <j:if test="${date == 'navigation-bottom'}">
                <div id="lastPublished">Last published: ${build.date}</div>
              </j:if>
            </div>
         </div>
         <!-- left column end -->
                
         <!-- body start -->
         <div id="bodyColumn">
           <div class="contentBox">
             <!-- FIXME really shouldn't use $doc, but jelly loses it's context again -->
             <jsl:applyTemplates select="$doc/document/body/section"/>
             <jsl:applyTemplates select="$doc/document/body/release" />
             <jsl:applyTemplates select="$doc/document/body/goals" />
           </div>
         </div>
         <div class="clear"><hr /></div>
         <!-- body end -->
          
                
         <!-- footer start -->    
         <div id="footer">  
            <jsl:applyTemplates select="$nav/body/footer"/>
            <div class="xright">
              <j:if test="${!empty(pom.organization.name)}">
                <j:if test="${!empty(pom.inceptionYear)}">
                  <j:if test="${pom.inceptionYear == mavenCurrentYear}">
                    &#169; ${mavenCurrentYear}, ${pom.organization.name}
                  </j:if>
                  <j:if test="${pom.inceptionYear != mavenCurrentYear}">
                    &#169; ${pom.inceptionYear}-${mavenCurrentYear}, ${pom.organization.name}
                  </j:if>
                </j:if>
                <j:if test="${empty(pom.inceptionYear)}">
                  &#169; ${mavenCurrentYear}, ${pom.organization.name}
                </j:if>
              </j:if>
              <j:if test="${date == 'bottom'}">
                - Last published: ${build.date}
              </j:if>
            </div>
            <div class="clear"><hr /></div>
          </div>
          <!-- footer end --> 
                
          
        </x:element>
      </html>
    </jsl:template>
  
    <!-- process the properties of the doc -->
    <jsl:template match="properties" trim="true">
      <!-- stick head block here later -->
    </jsl:template>
  
    <!-- Process a menu for the navigation bar -->
    <jsl:template match="menu" trim="true">
      <j:set var="_menuName"><x:expr select="@name"/></j:set>
      <j:set var="_menuName"><doc:escapeNameToken value="${_menuName}"/></j:set>
      <j:choose>
        <j:when test="${!empty(_menuName)}">
          <div id="menu${_menuName}">
            <h5><x:expr select="@name"/></h5>
            <ul><jsl:applyTemplates select="item"/></ul>
          </div>
        </j:when>
        <j:otherwise>
          <div>
            <h5><x:expr select="@name"/></h5>
            <ul><jsl:applyTemplates select="item"/></ul>
          </div>
        </j:otherwise>
      </j:choose>
      
    </jsl:template>
  
    <jsl:template match="item" trim="true">
      <x:set var="item" select="."/>
      <x:set var="_name" select="string(@name)"/>
      <x:set var="_link" select="string(@href)"/>
      <x:set var="_img" select="string(@img)"/>
      <x:set var="_childCount" select="count(./item)"/>
      <j:set var="_isCollapsed" value="${navbean.isCollapsed(item.get(0))}"/>
      <j:set var="_state" value="none"/>
      <j:if test="${_childCount.intValue() gt 0}">
        <j:if test="${!_isCollapsed}"><j:set var="_state" value="expanded"/></j:if>
        <j:if test="${_isCollapsed}"><j:set var="_state" value="collapsed"/></j:if>
      </j:if>
      <li class="${_state}">
        <j:if test="${navbean.isSelected(item.get(0))}">
          <strong><doc:itemLink name="${_name}" link="${_link}" img="${_img}" state="${_state}"/></strong>
        </j:if>
        <j:if test="${!navbean.isSelected(item.get(0))}">
          <doc:itemLink name="${_name}" link="${_link}" img="${_img}" state="${_state}"/>
        </j:if>
      </li>
  	  <j:if test="${!navbean.isCollapsed(item.get(0))}">
        <jsl:applyTemplates select="item"/>
      </j:if>
    </jsl:template>
  
    <!-- Process the breadcrumb navbar -->
    <jsl:template match="links" trim="true">
      <j:set var="linkCount" value="1"/>
      <x:forEach var="link" select="item">
        <j:set var="_name"><x:expr select="@name"/></j:set>
        <j:set var="_link"><x:expr select="@href"/></j:set>
        <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}"/>
        </j:whitespace>
        <j:set var="linkCount" value="${1+linkCount}"/>
      </x:forEach>
    </jsl:template>
  
    <!-- Google site search -->
    <jsl:template match="search" trim="true">
      <!-- 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 id="search">
        <h5>Search ${pom.name}</h5>
        <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" width="75" height="32" alt="Google" />
          </a>
          <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" id="q" size="15" name="q" maxlength="255" value=""/>
          <input type="submit" id="btnG" 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="true">
      <div class="section">
        <j:set var="_sectionName"><x:expr select="@name"/></j:set>
        <!-- named anchors can't contain whitespaces -->
        <j:set var="_anchorName"><doc:escapeNameToken value="${_sectionName}"/></j:set>
        <j:if test="${!empty(_sectionName)}">
            <h2><a name="${_anchorName}">${_sectionName}</a></h2>
        </j:if>
        <jsl:applyTemplates select="*"/>
      </div>
    </jsl:template>
  
    <jsl:template match="subsection" trim="true">
      <div class="subsection">
        <j:set var="_sectionName"><x:expr select="@name"/></j:set>
        <!-- named anchors can't contain whitespaces -->
        <j:set var="_anchorName"><doc:escapeNameToken value="${_sectionName}"/></j:set>
        <j:if test="${!empty(_sectionName)}">
            <h3><a name="${_anchorName}">${_sectionName}</a></h3>
        </j:if>
        <jsl:applyTemplates select="*"/>
      </div>
    </jsl:template>
  
    <jsl:template match="source" trim="false">
      <div class="source"><pre><x:expr select="."/></pre></div>
    </jsl:template>
    
    <!-- preserve whitespace in the following elements -->
    <jsl:template match="pre | script | style" trim="true">
      <x:set var="nodename" select="name()"/>
      <x:element name="${nodename}">
        <x:forEach var="attr" select="@*">
          <x:attribute name="${attr.name}">${attr.value}</x:attribute>
        </x:forEach>
        <j:whitespace trim="false"><x:expr select="."/></j:whitespace>
      </x:element>
    </jsl:template>
    
    <!-- xhtml fixup: add missing alt attribute for images -->
    <jsl:template match="img" trim="true">
      <x:element name="img">
        <x:forEach var="attr" select="@*">
          <x:attribute name="${attr.name}">${attr.value}</x:attribute>
        </x:forEach>
        <x:set var="noalt" select="count(./@alt) = 0" />
        <j:if test="${noalt}" >
          <x:attribute name="alt"></x:attribute>
        </j:if>
      </x:element>
    </jsl:template>
  
    <jsl:template match="footer" trim="true">
      <div class="xleft">
        <jsl:applyTemplates select="*"/>
      </div>
    </jsl:template>
  
    <jsl:template match="table" trim="true">
      <j:set var="rowcount" value="0"/>
      <table class="bodyTable">
        <jsl:applyTemplates select="*"/>
      </table>
    </jsl:template>
  
    <jsl:template match="tr" trim="true">
      <j:choose>
        <j:when test="${rowMode == 'a'}">
          <j:set var="rowMode" value="b"/>
        </j:when>
        <j:otherwise>
          <j:set var="rowMode" value="a"/>
        </j:otherwise>
      </j:choose>
      <x:element name="tr"><j:whitespace trim="true">
        <x:attribute name="class">${rowMode}</x:attribute>
        <x:forEach var="attr" select="@*">
          <x:attribute name="${attr.name}">${attr.value}</x:attribute>
        </x:forEach>
        <jsl:applyTemplates select="*"/>
  </j:whitespace></x:element>
    </jsl:template>
  
        <!--************************-->
        <!-- goals documentation    -->
        <!--************************-->
        <jsl:template match="goals" trim="true">
          <!-- reset row alternation -->
          <j:set var="rowMode" value="" />
          <div class="h3">
            <h3><a name="Goals">Goals</a></h3>
            <table class="bodyTable">
              <thead>
                <tr><th>Goal</th><th>Description</th></tr>
              </thead>
              <tbody>
                <jsl:applyTemplates select="goal"/>
              </tbody>
            </table>
          </div>
        </jsl:template>
        
        <!-- a goal -->
        <jsl:template match="goal" trim="true">
          <j:choose>
            <j:when test="${rowMode == 'a'}">
              <j:set var="rowMode" value="b"/>
            </j:when>
            <j:otherwise>
              <j:set var="rowMode" value="a"/>
            </j:otherwise>
          </j:choose>
          
          <x:element name="tr"><j:whitespace trim="true">
            <x:attribute name="class">${rowMode}</x:attribute>
            <j:set var="_goalName"><x:expr select="./name" /></j:set>
            <td style="width:20%"><a name="${_goalName}">${_goalName}</a></td>
            <td ><jsl:applyTemplates select="description" /></td>
  </j:whitespace></x:element>
        </jsl:template>   
        
        <jsl:template match="description">
          <jsl:applyTemplates trim="false"/>
        </jsl:template>
  
    <!-- remove the space at the end of parsed "a" anchors and fix local hrefs -->
    <jsl:template match="a" trim="true"><x:element name="a">
      <x:forEach var="attr" select="@*">
        <j:choose>
          <j:when test="${attr.name == 'href' and attr.value.startsWith('#')}">
            <x:attribute name="href"><doc:escapeNameToken value="${attr.value}"/></x:attribute>
          </j:when>
          <j:otherwise><x:attribute name="${attr.name}">${attr.value}</x:attribute></j:otherwise>
        </j:choose>
      </x:forEach>
      <jsl:applyTemplates/>
    </x:element></jsl:template>
     
    <!-- copy any other elements through -->
    <jsl:template match="*" trim="false"><jsl:copy trim="false"><jsl:applyTemplates trim="false"/></jsl:copy></jsl:template>
     
    <!-- element values don't pass through as text -->
    <jsl:template match="@*"/>
  
    <!-- CDATA and text nodes pass-thru -->
    <jsl:template match="text()"><x:expr select="."/></jsl:template>
  
  </jsl:stylesheet>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org