Browse Source

Document the use of @{attributes} inside <attribute/> definition.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276356 13f79535-47bb-0310-9956-ffa450edef68
master
Jan Materne 21 years ago
parent
commit
919e3d3e56
1 changed files with 30 additions and 6 deletions
  1. +30
    -6
      docs/manual/CoreTasks/macrodef.html

+ 30
- 6
docs/manual/CoreTasks/macrodef.html View File

@@ -1,5 +1,5 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Language" content="en-us"></meta> <meta http-equiv="Content-Language" content="en-us"></meta>
<title>MacroDef Task</title> <title>MacroDef Task</title>
@@ -9,18 +9,23 @@
--> -->
</style> </style>
</head> </head>
<body> <body>
<h2><a name="macrodef">MacroDef</a></h2> <h2><a name="macrodef">MacroDef</a></h2>
<h3>Description</h3> <h3>Description</h3>
<p> <p>
This defines a new task using a &lt;sequential&gt;
This defines a new task using a &lt;sequential&gt;
nested task as a template. Nested elements &lt;attribute&gt; and nested task as a template. Nested elements &lt;attribute&gt; and
&lt;element&gt; are used to specify attributes and elements of &lt;element&gt; are used to specify attributes and elements of
the new task. These get substituted into the &lt;sequential&gt; the new task. These get substituted into the &lt;sequential&gt;
task when the new task is run. task when the new task is run.
</p> </p>
<h3>Note</h3>
<p>
You can also use <i>prior defined</i> attributes for default-values in
other attributes. See the examples.
</p>
<p> <p>
<em>since Ant 1.6</em> <em>since Ant 1.6</em>
</p> </p>
@@ -183,7 +188,7 @@
<td valign="top" align="center">No</td> <td valign="top" align="center">No</td>
</tr> </tr>
</table> </table>
<h3>Examples</h3> <h3>Examples</h3>
<p> <p>
The following example defined a task called testing and The following example defined a task called testing and
@@ -264,6 +269,26 @@
&lt;echotest&gt; &lt;echotest&gt;
Hello world Hello world
&lt;/echotest&gt; &lt;/echotest&gt;
</pre>
</blockquote>
<p>
The following uses a prior defined attribut for setting the
default value of another. The output would be
<tt>one=test two=test</tt>. If you change the order of lines
*1 and *2 the output would be <tt>one=test two=@{one}</tt>,
because while processing the <i>two</i>-line the value for
<i>one</i> is not set.
</p>
<blockquote>
<pre class="code">
&lt;macrodef name="test"/&gt;
&lt;attribute name="one"/&gt; <b>*1</b>
&lt;attribute name="two" default="@{one}"/&gt; <b>*2</b>
&lt;sequential&gt;
&lt;echo&gt;one=@{one} two=@{two}&lt;/echo&gt;
&lt;/sequential&gt;
&lt;/macrodef/&gt;
&lt;test one="test"/&gt;
</pre> </pre>
</blockquote> </blockquote>
<hr> <hr>
@@ -272,4 +297,3 @@ Foundation. All rights Reserved.</p>


</body> </body>
</html> </html>


Loading…
Cancel
Save