#macro ( banner $id )
  #if ( $siteDescriptor.getChild( $id ) )
    #set ( $e = $siteDescriptor.getChild( $id ) )
    #if( $e.getChild( "href" ) )
        #set ( $link = $e.getChild( "href" ).getValue() )
        <a href="$link" id="$id">
    #else
        <span id="$id">
    #end

    #if( $e.getChild( "src" ) )
        #set ( $src = $e.getChild( "src" ).getValue() )
        #if ( ! ( $src.toLowerCase().startsWith("http") || $src.toLowerCase().startsWith("https") ) )
            #set ( $src = $PathTool.calculateLink( $src, $relativePath ) )
            #set ( $src = $src.replaceAll( "\\", "/" ) )
        #end
        #if ( $e.getChild( "alt" ) )
            #set ( $alt = $e.getChild( "alt" ).getValue() )
        #else
            #set ( $alt = "" )
        #end
        <img src="$src" alt="$alt" />
    #else
        $e.getChild( "name" ).getValue()
    #end

    #if( $e.getChild( "href" ) )
        </a>
    #else
        </span>
    #end
  #end
#end

#macro ( links )
  #set ( $counter = 0 )
  #set ( $links = $siteDescriptor.getChild( "body" ).getChild( "links" ) )
  #foreach( $item in $links.getChildren() )
    #set ( $counter = $counter + 1 )
    <a href="$item.getAttribute( "href" )">$item.getAttribute( "name" )</a>
    #if ( $links.getChildCount() > $counter )
      |
    #end
  #end
#end

#macro ( displayTree $display $item )
  #if ( $item && $item.getChildren() && $item.getChildCount() > 0 )
    #foreach( $subitem in $item.getChildren() )
      #set ( $subitemHref = $PathTool.calculateLink( $subitem.getAttribute( "href" ), $relativePath ) )
      #set ( $subitemHref = $subitemHref.replaceAll( "\\", "/" ) )

      #if ( $currentFileName == $subitemHref )
        #set ( $display = true )
      #end

      #displayTree( $display $subitem )
    #end
  #end
#end

#macro ( menuItem $item )
  #set ( $collapse = "none" )
  #set ( $currentItemHref = $PathTool.calculateLink( $item.getAttribute( "href" ), $relativePath ) )
  #set ( $currentFileName = $currentFileName.replaceAll( "\\", "/" ) )
  #set ( $currentItemHref = $currentItemHref.replaceAll( "\\", "/" ) )

  #if ( $item && $item.getChildCount() > 0 )
    #if ( ( $item.getAttribute( "collapse" ) ) && ( $item.getAttribute( "collapse" ).equalsIgnoreCase( "false" ) ) )
      #set ( $collapse = "expanded" )
    #else
      ## By default collapsed
      #set ( $collapse = "collapsed" )
    #end

    #if ( $currentFileName == $currentItemHref )
      #set ( $collapse = "expanded" )
    #end
  #end
  <li class="$collapse">
    #if ( $currentFileName == $currentItemHref )
      <strong><a href="$currentItemHref">$item.getAttribute( "name" )</a></strong>
    #else
      <a href="$currentItemHref">$item.getAttribute( "name" )</a>
    #end
  #if ( $item && $item.getChildren() && $item.getChildCount() > 0 )
    #set ( $display = false )
    #set ( $itemTmp = $item )
    #displayTree( $display $itemTmp )

    #if ( $collapse == "expanded" || $display )
      <ul>
        #foreach( $subitem in $item.getChildren() )
          #menuItem( $subitem )
        #end
      </ul>
    #end
  #end
  </li>
#end

#macro ( mainMenu )
  #set ( $menus = $siteDescriptor.getChild( "body" ).getChildren( "menu" ) )
  #foreach( $menu in $menus )
    <h5>$menu.getAttribute( "name" )</h5>
    <ul>
      #foreach( $item in $menu.getChildren() )
        #menuItem( $item )
      #end
    </ul>
  #end
#end

#macro ( copyright )
  #if ( $project )
    #set ( $currentYear = ${currentDate.year} + 1900 )

    #if ( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) )
      ${project.inceptionYear}-${currentYear}
    #else
      ${currentYear}
    #end

    #if ( ${project.organization} && ${project.organization.name} )
      ${project.organization.name}
    #end
  #end
#end

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>$title</title>
    <style type="text/css" media="all">
      @import url("$relativePath/css/maven-base.css");
      @import url("$relativePath/css/maven-theme.css");
      @import url("$relativePath/css/site.css");
    </style>
    <link rel="stylesheet" href="$relativePath/css/print.css" type="text/css" media="print" />
    #foreach( $author in $authors )
      <meta name="author" content="$author" />
    #end
    <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
  </head>
  <body class="composite">
    <div id="banner">
      #set ( $banner = "bannerLeft" )
      #banner( $banner )
      #set ( $banner = "bannerRight" )
      #banner( $banner )
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
      <div class="xleft">$i18n.getString( "site-plugin", $locale, "template.lastpublished" ): $currentDate</div>
      <div class="xright">#links()</div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
        #mainMenu()
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        $bodyContent
      </div>
    </div>
    <div class="clear">
      <br/>
    </div>
    <div id="footer" class="footer">
      <div class="xleft">
      &#169;#copyright()
      </div>
      <div class="xright">
      <a href="http://sourceforge.net"><img src="/images/sflogo.php.png" alt="SourceForge.net" style="width: 88px; height: 31px;"></a>
       <a href="https://sourceforge.net/donate/index.php?group_id=116930"><img style="width: 88px; height: 32px;" alt="" src="http://sourceforge.net/images/project-support.jpg"></a><br>
      </div>
       <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
