~ubuntu-branches/ubuntu/quantal/libtemplate-perl/quantal

« back to all changes in this revision

Viewing changes to html/manual/Variables.html

  • Committer: Package Import Robot
  • Author(s): Benjamin Mako Hill
  • Date: 2012-04-08 19:06:29 UTC
  • mfrom: (0.7.1) (0.5.2) (5.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20120408190629-wbcbs2ea39mex6lt
Tags: 2.24-1
* New upstream release (Closes: #664561)
* Bump Standards-Version to 3.9.3
* Changed to the short description to mention the term "Template
  Toolkit". (LP: #688836)

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
     desc  = 'Bogon Generator'
323
323
     price = 666
324
324
   }
325
 
%]</span></pre>
326
 
                        <pre># perl style
 
325
%]</span>
 
326
 
 
327
# perl style
327
328
<span class="tt">[% product = {
328
329
     id    =&gt; 'XYZ-2000',
329
330
     desc  =&gt; 'Bogon Generator',
407
408
                        </p>
408
409
                        <pre>my $vars = {
409
410
    wizard  =&gt; sub { return join(' ', 'Abracadabra!', @_) },
410
 
};  </pre>
 
411
};</pre>
411
412
                        <p>
412
413
                          Example template:
413
414
                        </p>
655
656
                      Curly braces can be used to delimit interpolated variable names where
656
657
                      necessary.
657
658
                    </p>
658
 
                    <pre><span class="tt">[% users.${me.id}.name %]</span>    </pre>
 
659
                    <pre><span class="tt">[% users.${me.id}.name %]</span></pre>
659
660
                    <p>
660
661
                      Directives such as <code>INCLUDE</code>, <code>PROCESS</code>, etc., that
661
662
                      accept a template name as the first argument, will automatically quote it
1012
1013
                        <pre><span class="tt">[% WRAPPER box %]</span>
1013
1014
Be not afeard; the isle is full of noises,
1014
1015
Sounds and sweet airs, that give delight and hurt not.
1015
 
<span class="tt">[% END %]</span></pre>
1016
 
                        <pre><span class="tt">[% BLOCK box %]</span>
 
1016
<span class="tt">[% END %]</span>
 
1017
 
 
1018
<span class="tt">[% BLOCK box %]</span>
1017
1019
&lt;blockquote class="prose"&gt;
1018
1020
  <span class="tt">[% content %]</span>
1019
1021
&lt;/blockquote&gt;
1066
1068
          </div>
1067
1069
          </div>
1068
1070
          <div class="copyright">
1069
 
            Copyright &copy; 1996-2008 <a href="http://wardley.org/">Andy Wardley</a>.  All Rights Reserved.
 
1071
            Copyright &copy; 1996-2012 <a href="http://wardley.org/">Andy Wardley</a>.  All Rights Reserved.
1070
1072
          </div>
1071
1073
          <div class="licence">
1072
1074
            The <a href="http://template-toolkit.org/">Template Toolkit</a> is <a href="http://opensource.org/">Open Source</a> software.