[Templates-cvs] cvs commit: Template2/docsrc/src/Modules/Template/Plugin Image.tt2

cvs@template-toolkit.org cvs@template-toolkit.org


cvs         06/01/30 16:17:08

  Modified:    docsrc/src/Modules/Template/Plugin Image.tt2
  Log:
  * updated docs to mention alt attribute
  
  Revision  Changes    Path
  1.5       +21 -9     Template2/docsrc/src/Modules/Template/Plugin/Image.tt2
  
  Index: Image.tt2
  ===================================================================
  RCS file: /template-toolkit/Template2/docsrc/src/Modules/Template/Plugin/Image.tt2,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Image.tt2	2006/01/30 14:44:32	1.4
  +++ Image.tt2	2006/01/30 16:17:07	1.5
  @@ -35,6 +35,12 @@
   
       [% USE Image(file='/path/to/home.png', name='/images/home.png') %]
   
  +The "alt" parameter can be used to specify an alternate name for the
  +image, for use in constructing an XHTML element (see the tag() method
  +below).
  +
  +    [% USE Image('home.png', alt="Home") %]
  +
   You can also provide an alternate name for an Image plugin object.
   
       [% USE img1 = image 'foo.gif' %]
  @@ -49,6 +55,13 @@
       height: [% image.height %]
       size: [% image.size.join(', ') %]
   
  +The 'modtime' method returns the ctime of the file in question, suitable
  +for use with date.format:
  +
  +    [% USE image 'foo.gif' %]
  +    [% USE date %]
  +    [% date.format(image.modtime, "%B, %e %Y") %]
  +
   The 'attr' method returns the height and width as HTML/XML attributes.
   
       [% USE image 'foo.gif' %]
  @@ -65,25 +78,24 @@
   
   Typical output:
   
  -    <img src="foo.gif" width="60" height="20" />
  +    <img src="foo.gif" width="60" height="20" alt="" />
   
   You can provide any additional attributes that should be added to the 
   XHTML tag.
   
  -
       [% USE image 'foo.gif' %]
  -    [% image.tag(border=0, class="logo") %]
  +    [% image.tag(class="logo" alt="Logo") %]
   
   Typical output:
   
  -    <img src="foo.gif" width="60" height="20" border="0" class="logo" />
  +    <img src="foo.gif" width="60" height="20" alt="Logo" class="logo" />
   
  -The 'modtime' method returns the ctime of the file in question, suitable
  -for use with date.format:
  +Note that the 'alt' attribute is mandatory in a strict XHTML 'img'
  +element (even if it's empty) so it is always added even if you don't
  +explicitly provide a value for it.  You can do so as an argument to 
  +the 'tag' method, as shown in the previous example, or as an argument
   
  -    [% USE image 'foo.gif' %]
  -    [% USE date %]
  -    [% date.format(image.modtime, "%B, %e %Y") %]
  +    [% USE image('foo.gif', alt='Logo') %]
   
   =head1 CATCHING ERRORS