You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2002/02/03 08:14:48 UTC

cvs commit: jakarta-ant/proposal/myrmidon/src/xdocs/stylesheets templates.vm

donaldp     02/02/02 23:14:48

  Added:       proposal/myrmidon/src/xdocs velocity.properties
               proposal/myrmidon/src/xdocs/stylesheets templates.vm
  Log:
  Add in some documentation stuff
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/xdocs/velocity.properties
  
  Index: velocity.properties
  ===================================================================
  file.resource.loader.path=src/xdocs/stylesheets
  velocimacro.library=templates.vm
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/xdocs/stylesheets/templates.vm
  
  Index: templates.vm
  ===================================================================
  ## This is where the common macro's live
  
  #macro ( table $table)
    <table>
    #foreach ( $items in $table.getChildren() )
      #if ($items.getName().equals("tr"))
        #tr ($items)
      #end
    #end
    </table>
  #end
  
  #macro ( tr $tr)
    <tr>
    #foreach ( $items in $tr.getChildren() )
      #if ($items.getName().equals("td"))
        #td ($items)
      #elseif ($items.getName().equals("th"))
        #th ($items)
      #end
    #end
  </tr>
  #end
  
  #macro ( td $value)
    #if ($value.getAttributeValue("colspan"))
      #set ($colspan = $value.getAttributeValue("colspan"))
    #end
    #if ($value.getAttributeValue("rowspan"))
      #set ($rowspan = $value.getAttributeValue("rowspan"))
    #end
    <td bgcolor="$tabletdbg" colspan="$!colspan" rowspan="$!rowspan" 
        valign="top" align="left">
      <font color="#000000" size="-1" face="arial,helvetica,sanserif">
      #if ($value.getText().length() != 0 || $value.hasChildren())
        $xmlout.outputString($value, true)
      #else
        &nbsp;
      #end
      </font>
    </td>
  #end
  
  #macro ( th $value)
    #if ($value.getAttributeValue("colspan"))
      #set ($colspan = $value.getAttributeValue("colspan"))
    #end
    #if ($value.getAttributeValue("rowspan"))
      #set ($rowspan = $value.getAttributeValue("rowspan"))
    #end
    <td bgcolor="$tablethbg" colspan="$!colspan" rowspan="$!rowspan" 
        valign="top" align="left">
      <font color="#000000" size="-1" face="arial,helvetica,sanserif">
      #if ($value.getText().length() != 0 || $value.hasChildren())
        $xmlout.outputString($value, true)
      #else
        &nbsp;
      #end
      </font>
    </td>
  #end
  
  #macro ( projectanchor $name $value )
    #if ($value.startsWith("http://"))
      <a href="$value">$name</a>
    #elseif ($value.startsWith("/site"))
      <a href="http://jakarta.apache.org$value">$name</a>
    #else
      <a href="$relativePath$value">$name</a>
    #end
  #end
  
  #macro ( metaauthor $author $email )
    <meta name="author" value="$author">
    <meta name="email" value="$email">
  #end
  
  #macro ( image $value )
    #if ($value.getAttributeValue("width"))
      #set ($width=$value.getAttributeValue("width"))
    #end
    #if ($value.getAttributeValue("height"))
      #set ($height=$value.getAttributeValue("height"))
    #end
    #if ($value.getAttributeValue("align"))
      #set ($align=$value.getAttributeValue("align"))
    #end
    <img src="$relativePath$value.getAttributeValue("src")" 
         width="$!width" height="$!height" align="$!align">
  #end
  
  #macro ( source $value)
    <div align="left">
      <table cellspacing="4" cellpadding="0" border="0">
        <tr>
          <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
          <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
          <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
          <td bgcolor="#ffffff"><pre>$escape.getText($value.getText())</pre></td>
          <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
          <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
          <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        </tr>
      </table>
    </div>
  #end
  
  #macro ( makeProject )
    #set ($menus = $project.getChild("body").getChildren("menu"))
    #foreach ( $menu in $menus )
      <p><strong>$menu.getAttributeValue("name")</strong></p>
      <ul>
      #foreach ( $item in $menu.getChildren() )
        #set ($name = $item.getAttributeValue("name"))
        <li>#projectanchor($name $item.getAttributeValue("href"))</li>
      #end
      </ul>
    #end
  #end
  
  #macro (getProjectImage)
    #if ($project.getChild("logo"))
      <td align="left">
      <a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" border="0"/></a>
      </td>
      <td align="right">
      #set ( $logoString = $project.getChild("logo").getAttributeValue("href") )
      #if ( $logoString.startsWith("/") )
        <a href="$project.getAttributeValue("href")"><img src="$relativePath$logoString" alt="$project.getChild("logo").getText()" border="0"/></a>
      #else
        <a href="$project.getAttributeValue("href")"><img src="$relativePath/$logoString" alt="$project.getChild("logo").getText()" border="0"/></a>
      #end
      </td>
    #else
      <td colspan="2">
      <a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" align="left" border="0"/></a>
      </td>
    #end
  #end
  
  #macro (header)
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    
        #set ($authors = $root.getChild("properties").getChildren("author"))
        #foreach ( $au in $authors )
          #metaauthor ( $au.getText() $au.getAttributeValue("email") )
        #end
    
        <title>$project.getChild("title").getText() - $root.getChild("properties").getChild("title").getText()</title>
      </head>
    
      <body bgcolor="$bodybg" text="$bodyfg" link="$bodylink">    
        <table border="0" width="100%" cellspacing="0">
          <!-- TOP IMAGE -->
          <tr>
            #getProjectImage()
          </tr>
        </table>
        <table border="0" width="100%" cellspacing="4">
          <tr><td colspan="2">
            <hr noshade="" size="1"/>
          </td></tr>
          
          <tr>
            <!-- LEFT SIDE NAVIGATION -->
            <td valign="top" nowrap="true">
            #makeProject()
            </td>
            <td align="left" valign="top">
  #end
  
  #macro (footer)
            </td>
          </tr>
  
          <!-- FOOTER -->
          <tr><td colspan="2">
            <hr noshade="" size="1"/>
          </td></tr>
          <tr><td colspan="2">
            <div align="center"><font color="$bodylink" size="-1"><em>
            Copyright &#169; 2000-2002, Apache Software Foundation
            </em></font></div>
          </td></tr>
        </table>
      </body>
    </html>
  #end
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>