You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

templates.vm 7.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. ## This is where the common macro's live
  2. #macro ( table $table)
  3. <table>
  4. #foreach ( $items in $table.getChildren() )
  5. #if ($items.getName().equals("tr"))
  6. #tr ($items)
  7. #end
  8. #end
  9. </table>
  10. #end
  11. #macro ( tr $tr)
  12. <tr>
  13. #foreach ( $items in $tr.getChildren() )
  14. #if ($items.getName().equals("td"))
  15. #td ($items)
  16. #elseif ($items.getName().equals("th"))
  17. #th ($items)
  18. #end
  19. #end
  20. </tr>
  21. #end
  22. #macro ( td $value)
  23. #if ($value.getAttributeValue("colspan"))
  24. #set ($colspan = $value.getAttributeValue("colspan"))
  25. #else
  26. #set ($colspan = 1)
  27. #end
  28. #if ($value.getAttributeValue("rowspan"))
  29. #set ($rowspan = $value.getAttributeValue("rowspan"))
  30. #else
  31. #set ($rowspan = 1)
  32. #end
  33. <td bgcolor="$tabletdbg" colspan="$!colspan" rowspan="$!rowspan"
  34. valign="top" align="left">
  35. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  36. #if ($value.getText().length() != 0 || $value.hasChildren())
  37. $xmlout.outputString($value, true)
  38. #else
  39. &nbsp;
  40. #end
  41. </font>
  42. </td>
  43. #end
  44. #macro ( th $value)
  45. #if ($value.getAttributeValue("colspan"))
  46. #set ($colspan = $value.getAttributeValue("colspan"))
  47. #else
  48. #set ($colspan = 1)
  49. #end
  50. #if ($value.getAttributeValue("rowspan"))
  51. #set ($rowspan = $value.getAttributeValue("rowspan"))
  52. #else
  53. #set ($rowspan = 1)
  54. #end
  55. <td bgcolor="$tablethbg" colspan="$!colspan" rowspan="$!rowspan"
  56. valign="top" align="left">
  57. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  58. #if ($value.getText().length() != 0 || $value.hasChildren())
  59. $xmlout.outputString($value, true)
  60. #else
  61. &nbsp;
  62. #end
  63. </font>
  64. </td>
  65. #end
  66. #macro ( projectanchor $name $value )
  67. #if ($value.startsWith("http://"))
  68. <a href="$value">$name</a>
  69. #elseif ($value.startsWith("/site"))
  70. <a href="http://jakarta.apache.org$value">$name</a>
  71. #else
  72. <a href="$relativePath$value">$name</a>
  73. #end
  74. #end
  75. #macro ( metaauthor $author $email )
  76. <meta name="author" content="$author">
  77. <meta name="email" content="$email">
  78. #end
  79. #macro ( image $value )
  80. #if ($value.getAttributeValue("width"))
  81. #set ($width=$value.getAttributeValue("width"))
  82. #end
  83. #if ($value.getAttributeValue("height"))
  84. #set ($height=$value.getAttributeValue("height"))
  85. #end
  86. #if ($value.getAttributeValue("align"))
  87. #set ($align=$value.getAttributeValue("align"))
  88. #end
  89. #if ($value.getAttributeValue("alt"))
  90. #set ($align=$value.getAttributeValue("alt"))
  91. #end
  92. <img src="$relativePath$value.getAttributeValue("src")"
  93. width="$!width" height="$!height" align="$!align" alt="$!align">
  94. #end
  95. #macro ( source $value)
  96. <div align="left">
  97. <table cellspacing="4" cellpadding="0" border="0">
  98. <tr>
  99. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  100. <td bgcolor="#023264" height="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  101. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  102. </tr>
  103. <tr>
  104. <td bgcolor="#023264" width="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  105. <td bgcolor="#ffffff"><pre>$escape.getText($value.getText())</pre></td>
  106. <td bgcolor="#023264" width="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  107. </tr>
  108. <tr>
  109. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  110. <td bgcolor="#023264" height="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  111. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  112. </tr>
  113. </table>
  114. </div>
  115. #end
  116. #macro ( makeProject )
  117. #set ($menus = $project.getChild("body").getChildren("menu"))
  118. #foreach ( $menu in $menus )
  119. <p><strong>$menu.getAttributeValue("name")</strong></p>
  120. <ul>
  121. #foreach ( $item in $menu.getChildren() )
  122. #set ($name = $item.getAttributeValue("name"))
  123. <li>#projectanchor($name $item.getAttributeValue("href"))</li>
  124. #end
  125. </ul>
  126. #end
  127. #end
  128. #macro (getProjectImage)
  129. #if ($project.getChild("logo"))
  130. <td align="left">
  131. <a href="http://jakarta.apache.org"><img src="images/jakarta-logo.gif" alt="The Apache Jakarta Project" border="0"></a>
  132. </td>
  133. <td align="right">
  134. #set ( $logoString = $project.getChild("logo").getAttributeValue("href") )
  135. #if ( $logoString.startsWith("/") )
  136. <a href="$project.getAttributeValue("href")"><img src="$relativePath$logoString" alt="$project.getChild("logo").getText()" border="0"/></a>
  137. #else
  138. <a href="$project.getAttributeValue("href")"><img src="$relativePath/$logoString" alt="$project.getChild("logo").getText()" border="0"/></a>
  139. #end
  140. </td>
  141. #else
  142. <td colspan="2">
  143. <a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="The Apache Jakarta Project" align="left" border="0"/></a>
  144. </td>
  145. #end
  146. #end
  147. #macro (header)
  148. <html>
  149. <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! -->
  150. <head>
  151. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  152. #set ($authors = $root.getChild("properties").getChildren("author"))
  153. #foreach ( $au in $authors )
  154. #metaauthor ( $au.getText() $au.getAttributeValue("email") )
  155. #end
  156. #if ($root.getChild("properties").getChild("base"))
  157. #set ($url = $root.getChild("properties").getChild("base").getAttributeValue("href"))
  158. #if ($url)
  159. <base href="$url">
  160. #else
  161. <base href="$project.getAttributeValue("href")$relativePath">
  162. #end
  163. #end
  164. <title>$project.getChild("title").getText() - $root.getChild("properties").getChild("title").getText()</title>
  165. </head>
  166. <body bgcolor="$bodybg" text="$bodyfg" link="$bodylink">
  167. <table border="0" width="100%" cellspacing="0">
  168. <!-- TOP IMAGE -->
  169. <tr>
  170. #getProjectImage()
  171. </tr>
  172. </table>
  173. <table border="0" width="100%" cellspacing="4">
  174. <tr><td colspan="2">
  175. <hr noshade size="1"/>
  176. </td></tr>
  177. <tr>
  178. <!-- LEFT SIDE NAVIGATION -->
  179. <td valign="top" nowrap>
  180. #makeProject()
  181. </td>
  182. <td align="left" valign="top">
  183. #end
  184. #macro (footer)
  185. </td>
  186. </tr>
  187. <!-- FOOTER -->
  188. <tr><td colspan="2">
  189. <hr noshade size="1"/>
  190. </td></tr>
  191. <tr><td colspan="2">
  192. <div align="center"><font color="$bodylink" size="-1"><em>
  193. Copyright &#169; 2000-2003, Apache Software Foundation
  194. </em></font></div>
  195. </td></tr>
  196. </table>
  197. </body>
  198. </html>
  199. #end