[Templates-cvs] cvs commit: Template2/lib/Template/Manual Config.pod Credits.pod Directives.pod Filters.pod Internals.pod Intro.pod Plugins.pod Refs.pod Syntax.pod VMethods.pod Variables.pod Views.pod

cvs@template-toolkit.org cvs@template-toolkit.org
Thu, 24 Jul 2003 17:16:33 +0100


cvs         03/07/24 16:16:33

  Modified:    lib/Template/Manual Config.pod Credits.pod Directives.pod
                        Filters.pod Internals.pod Intro.pod Plugins.pod
                        Refs.pod Syntax.pod VMethods.pod Variables.pod
                        Views.pod
  Log:
  version 2.10
  
  Revision  Changes    Path
  1.46      +2 -2      Template2/lib/Template/Manual/Config.pod
  
  Index: Config.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Config.pod,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- Config.pod	2003/04/24 09:14:40	1.45
  +++ Config.pod	2003/07/24 16:16:31	1.46
  @@ -2099,11 +2099,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.46      +3 -2      Template2/lib/Template/Manual/Credits.pod
  
  Index: Credits.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Credits.pod,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- Credits.pod	2003/04/24 09:14:40	1.45
  +++ Credits.pod	2003/07/24 16:16:31	1.46
  @@ -117,6 +117,7 @@
     Colin Johnson             <colin@knowledgepool.com>
     Vivek Khera               <khera@kciLink.com>
     Rafael Kitover            <caelum@debian.org>
  +  Ivan Kurmanov             <kurmanov@openlib.org>
     Hans von Lengerke         <hans@lengerke.org>
     Jonas Liljegren           <jonas@paranormal.se>
     Simon Luff                <simon@sports.com>
  @@ -158,11 +159,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.45      +17 -13    Template2/lib/Template/Manual/Directives.pod
  
  Index: Directives.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Directives.pod,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- Directives.pod	2003/04/24 09:14:40	1.44
  +++ Directives.pod	2003/07/24 16:16:31	1.45
  @@ -322,7 +322,7 @@
   
   Local variable definitions may be specified after the template name,
   temporarily masking any existing variables.  Insignificant whitespace
  -is ignore within directives so you can add variable definitions on the
  +is ignored within directives so you can add variable definitions on the
   same line, the next line or split across several line with comments
   interspersed, if you prefer.
   
  @@ -755,6 +755,10 @@
         * Foo
         * Foo Bar
   
  +You can use also use 'IN' instead of '=' if you prefer.
  +
  +    [% FOREACH crook IN government %]
  +    
   When the FOREACH directive is used without specifying a target variable, 
   any iterated values which are hash references will be automatically 
   imported.
  @@ -766,7 +770,7 @@
          ]
       %]
   
  -    [% FOREACH user = userlist %]
  +    [% FOREACH user IN userlist %]
          [% user.id %] [% user.name %]
       [% END %]
   
  @@ -799,7 +803,7 @@
          }
       %]
   
  -    [% FOREACH u = users %]
  +    [% FOREACH u IN users %]
          * [% u.key %] : [% u.value %]
       [% END %]
   
  @@ -811,7 +815,7 @@
   
   The NEXT directive starts the next iteration in the FOREACH loop.
   
  -    [% FOREACH user = userlist %]
  +    [% FOREACH user IN userlist %]
          [% NEXT IF user.isguest %]
          Name: [% user.name %]    Email: [% user.email %]
       [% END %]
  @@ -819,7 +823,7 @@
   The LAST directive can be used to prematurely exit the loop.  BREAK is
   also provided as an alias for LAST.
   
  -    [% FOREACH match = results.nsort('score').reverse %]
  +    [% FOREACH match IN results.nsort('score').reverse %]
          [% LAST IF match.score < 50 %]
          [% match.score %] : [% match.url %]
       [% END %]
  @@ -842,7 +846,7 @@
   
   Example:
   
  -    [% FOREACH item = [ 'foo', 'bar', 'baz' ] -%]
  +    [% FOREACH item IN [ 'foo', 'bar', 'baz' ] -%]
          [%- "<ul>\n" IF loop.first %]
          <li>[% loop.count %]/[% loop.size %]: [% item %]
          [%- "</ul>\n" IF loop.last %]
  @@ -863,11 +867,11 @@
   referencing the innermost loop and being restored to any previous 
   value (i.e. an outer loop) at the end of the loop.
   
  -    [% FOREACH group = grouplist;
  +    [% FOREACH group IN grouplist;
   	   # loop => group iterator
              "Groups:\n" IF loop.first;
   
  -           FOREACH user = group.userlist;
  +           FOREACH user IN group.userlist;
                  # loop => user iterator
   	       "$loop.count: $user.name\n";
   	   END;
  @@ -886,8 +890,8 @@
   
       [% USE giter = iterator(grouplist) %]
   
  -    [% FOREACH group = giter %]
  -       [% FOREACH user = group.userlist %]
  +    [% FOREACH group IN giter %]
  +       [% FOREACH user IN group.userlist %]
                user #[% loop.count %] in
                group [% giter.count %] is
                named [% user.name %]
  @@ -1304,7 +1308,7 @@
   equivalent to:
   
       [% INCLUDE header title='Hello World' %]
  -    [% INCLUDE header title='Hello World' bgcol='#123456# %]
  +    [% INCLUDE header title='Hello World' bgcol='#123456' %]
   
   Here's another example, defining a macro for display numbers
   in comma-delimited groups of 3, using the chunk and join virtual
  @@ -2152,11 +2156,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.44      +30 -7     Template2/lib/Template/Manual/Filters.pod
  
  Index: Filters.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Filters.pod,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Filters.pod	2003/04/24 09:14:40	1.43
  +++ Filters.pod	2003/07/24 16:16:31	1.44
  @@ -154,7 +154,7 @@
   encoded (via the escape_html() or encode_entities() subroutines
   respectively) to convert all extended characters into their
   appropriate HTML entities (e.g. converting 'é' to '&eacute;').  If
  -neither module is available on your system then an 'html_all' exception
  +neither module is available on your system then an 'html_entity' exception
   will be thrown reporting an appropriate message.   
   
   For further information on HTML entity encoding, see
  @@ -305,7 +305,7 @@
   
       The_cat_sat_on_the_mat
   
  -=head2 redirect(file)
  +=head2 redirect(file, options)
   
   The 'redirect' filter redirects the output of the block into a separate
   file, specified relative to the OUTPUT_PATH configuration item.
  @@ -325,6 +325,22 @@
   
   A 'file' exception will be thrown if the OUTPUT_PATH option is undefined.
   
  +An optional 'binmode' argument can follow the filename to explicitly set
  +the output file to binary mode.
  +
  +    [% PROCESS my/png/generator 
  +         FILTER redirect("images/logo.png", binmode=1) %]
  +
  +For backwards compatibility with earlier versions, a single true/false
  +value can be used to set binary mode.
  +
  +    [% PROCESS my/png/generator 
  +         FILTER redirect("images/logo.png", 1) %]
  +
  +For the sake of future compatibility and clarity, if nothing else, we
  +would strongly recommend you explicitly use the named 'binmode' option
  +as shown in the first example.
  +
   =head2 eval / evaltt
   
   The 'eval' filter evaluates the block as template text, processing
  @@ -374,11 +390,18 @@
   The 'evalperl' filter is provided as an alias for 'perl' for backwards
   compatibility.
   
  -=head2 stdout(binmode)
  +=head2 stdout(options)
   
   The stdout filter prints the output generated by the enclosing block to
  -STDOUT.  If binmode is set, binary mode on STDOUT is turned on (see the
  -binmode perl function.
  +STDOUT.  The 'binmode' option can be passed as either a named parameter
  +or a single argument to set STDOUT to binary mode (see the
  +binmode perl function).
  +
  +    [% PROCESS something/cool
  +           FILTER stdout(binmode=1) # recommended %]
  +
  +    [% PROCESS something/cool
  +           FILTER stdout(1)         # alternate %]
   
   The stdout filter can be used to force binmode on STDOUT, or also inside
   redirect, null or stderr blocks to make sure that particular output goes
  @@ -483,11 +506,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.45      +2 -2      Template2/lib/Template/Manual/Internals.pod
  
  Index: Internals.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Internals.pod,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- Internals.pod	2003/04/24 09:14:40	1.44
  +++ Internals.pod	2003/07/24 16:16:31	1.45
  @@ -533,11 +533,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.44      +2 -2      Template2/lib/Template/Manual/Intro.pod
  
  Index: Intro.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Intro.pod,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Intro.pod	2003/04/24 09:14:40	1.43
  +++ Intro.pod	2003/07/24 16:16:31	1.44
  @@ -272,11 +272,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.44      +2 -2      Template2/lib/Template/Manual/Plugins.pod
  
  Index: Plugins.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Plugins.pod,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Plugins.pod	2003/04/24 09:14:40	1.43
  +++ Plugins.pod	2003/07/24 16:16:31	1.44
  @@ -529,11 +529,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.44      +2 -2      Template2/lib/Template/Manual/Refs.pod
  
  Index: Refs.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Refs.pod,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Refs.pod	2003/04/24 09:14:40	1.43
  +++ Refs.pod	2003/07/24 16:16:31	1.44
  @@ -148,11 +148,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.44      +2 -2      Template2/lib/Template/Manual/Syntax.pod
  
  Index: Syntax.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Syntax.pod,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Syntax.pod	2003/04/24 09:14:40	1.43
  +++ Syntax.pod	2003/07/24 16:16:31	1.44
  @@ -283,11 +283,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.9       +24 -6     Template2/lib/Template/Manual/VMethods.pod
  
  Index: VMethods.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/VMethods.pod,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- VMethods.pod	2003/04/24 09:14:40	1.8
  +++ VMethods.pod	2003/07/24 16:16:32	1.9
  @@ -104,6 +104,18 @@
          pattern does not match
       [% END %]
   
  +Any regex modifiers, like C</s>, should be added in the regex using
  +the C<(?s)> syntax.  For example, to modify the regex to disregard
  +whitespace (the C</x> switch), use:
  +
  +    [% re = '(?x)
  +               (\w+)
  +               [ ]
  +               (\w+)
  +             ';
  +      matches = name.match(re);
  +    %]
  +
   =item search(pattern)
   
   Performs a similar function to 'match' but simply returns true if the 
  @@ -162,7 +174,7 @@
   
   Return the value as a hash reference containing a single entry with
   the key 'value' indicating the original scalar value.  As with the 
  -'hash' virtual method, this is generally used to help massage data
  +'list' virtual method, this is generally used to help massage data
   into different formats.
   
   =item size
  @@ -246,8 +258,9 @@
   return a list of the keys (same as hash.keys), 'values' to return a
   list of the values (same as hash.values), or 'each' to return as list
   of (key, value) pairs (same as hash.each).  When called without an
  -argument it returns a list of hash references each containing a 'key'
  -and 'value' item representing 
  +argument it returns a list of hash references, each of which contains
  +a 'key' and 'value' item representing a single key =E<gt> value pair
  +in the hash.
   
   =back
   
  @@ -263,6 +276,11 @@
   
       [% results.first %] to [% results.last %]
   
  +If either is given a numeric argument C<n>, they return the first or
  +last C<n> elements:
  +
  +    The first 5 results are [% results.first(5).join(", ") %].
  +
   =item size, max
   
   Returns the size of a list (number of elements) and the maximum 
  @@ -334,7 +352,7 @@
       [% numbers = mylist.unique %]
   
   While this can be explicitly sorted, it is not required that the list
  -be sorted before the unique elements pulled out (unlike the Unix
  +be sorted before the unique elements are pulled out (unlike the Unix
   command line utility).
   
       [% numbers = mylist.unique.sort %]
  @@ -488,11 +506,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.45      +2 -2      Template2/lib/Template/Manual/Variables.pod
  
  Index: Variables.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Variables.pod,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- Variables.pod	2003/04/24 09:14:40	1.44
  +++ Variables.pod	2003/07/24 16:16:32	1.45
  @@ -845,11 +845,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or
  
  
  
  1.44      +2 -2      Template2/lib/Template/Manual/Views.pod
  
  Index: Views.pod
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Manual/Views.pod,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Views.pod	2003/04/24 09:14:40	1.43
  +++ Views.pod	2003/07/24 16:16:32	1.44
  @@ -619,11 +619,11 @@
   
   =head1 VERSION
   
  -Template Toolkit version 2.09b, released on 24 April 2003.
  +Template Toolkit version 2.10, released on 24 July 2003.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2003 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or