ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject svn commit: r1292986 - in /ant/site/ant: production/faq.html sources/faq.xml
Date Thu, 23 Feb 2012 22:16:14 GMT
Author: jglick
Date: Thu Feb 23 22:16:14 2012
New Revision: 1292986

URL: http://svn.apache.org/viewvc?rev=1292986&view=rev
Log:
#52621 / #42046 FAQ updates.

Modified:
    ant/site/ant/production/faq.html
    ant/site/ant/sources/faq.xml

Modified: ant/site/ant/production/faq.html
URL: http://svn.apache.org/viewvc/ant/site/ant/production/faq.html?rev=1292986&r1=1292985&r2=1292986&view=diff
==============================================================================
--- ant/site/ant/production/faq.html (original)
+++ ant/site/ant/production/faq.html Thu Feb 23 22:16:14 2012
@@ -1222,7 +1222,7 @@ shell-prompt> m4 foo.m4 > foo
       How can I do something like <code>&lt;property name="prop"
       value="${${anotherprop}}"/&gt;</code> (double expanding the property)?
     </p>
-                  <p>Without any external help you can not.</p>
+                  <p>Without any external help it is tricky.</p>
                         <p>With &lt;script/&gt;, which needs external libraries,
you can do</p>
                         <pre class="code">
 &lt;script language=&quot;javascript&quot;&gt;
@@ -1568,9 +1568,7 @@ shell-prompt&gt; m4 foo.m4 &gt; foo
   &lt;echotest message=&quot;$${basedir}&quot; /&gt;
 </pre>
                         <p>echos the value of the basedir property rather than the
-          text ${basedir} one would expect.  This is
-          a <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=42046">known
-            issue</a>.</p>
+          text ${basedir} one would expect.</p>
                         <p>It happens because <code>${}</code> sequences
are expanded
           once before expanding <code>@{}</code> sequences and once
           afterwards.  This is required to make things like the
@@ -1586,6 +1584,16 @@ shell-prompt&gt; m4 foo.m4 &gt; foo
 </pre>
                         <p>which wouldn't be possible if properties weren't expanded
         twice.</p>
+                        <p>If you want to avoid the double expansion, since Ant 1.8.3
you can turn it off explicitly:</p>
+                        <pre class="code">
+  &lt;macrodef name=&quot;echotest&quot;&gt;
+    &lt;attribute name=&quot;message&quot; doubleexpanding=&quot;false&quot;
/&gt;
+    &lt;sequential&gt;
+      &lt;echo message=&quot;@{message}&quot; /&gt;
+    &lt;/sequential&gt;
+  &lt;/macrodef&gt;
+  &lt;echotest message=&quot;$${basedir}&quot; /&gt;
+</pre>
                                 <p class="faq">
       <a name="integration"></a>
       Is Apache Ant supported by my IDE/Editor?

Modified: ant/site/ant/sources/faq.xml
URL: http://svn.apache.org/viewvc/ant/site/ant/sources/faq.xml?rev=1292986&r1=1292985&r2=1292986&view=diff
==============================================================================
--- ant/site/ant/sources/faq.xml (original)
+++ ant/site/ant/sources/faq.xml Thu Feb 23 22:16:14 2012
@@ -730,7 +730,7 @@ shell-prompt> m4 foo.m4 > foo
       value="${${anotherprop}}"/&gt;</code> (double expanding the property)?</question>
 
       <answer>
-        <p>Without any external help you can not.</p>
+        <p>Without any external help it is tricky.</p>
         <p>With &lt;script/&gt;, which needs external libraries, you can do</p>
         <source><![CDATA[
 <script language="javascript">
@@ -1149,9 +1149,7 @@ shell-prompt> m4 foo.m4 > foo
 ]]></source>
 
         <p>echos the value of the basedir property rather than the
-          text ${basedir} one would expect.  This is
-          a <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=42046">known
-            issue</a>.</p>
+          text ${basedir} one would expect.</p>
 
         <p>It happens because <code>${}</code> sequences are expanded
           once before expanding <code>@{}</code> sequences and once
@@ -1170,6 +1168,17 @@ shell-prompt> m4 foo.m4 > foo
 
         <p>which wouldn't be possible if properties weren't expanded
         twice.</p>
+
+        <p>If you want to avoid the double expansion, since Ant 1.8.3 you can turn
it off explicitly:</p>
+<source><![CDATA[
+  <macrodef name="echotest">
+    <attribute name="message" doubleexpanding="false" />
+    <sequential>
+      <echo message="@{message}" />
+    </sequential>
+  </macrodef>
+  <echotest message="$${basedir}" />
+]]></source>
       </answer>
     </faq>
   </faqsection>



Mime
View raw message