Re: [Templates] TT2 quick reference card

[prev] [thread] [next] [Date index for 2004/06/03]

From: Andrew Ford
Subject: Re: [Templates] TT2 quick reference card
Date: 20:47 on 03 Jun 2004
This is a multi-part message in MIME format.
--------------050100060301020105020108
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Jason Gottshall wrote:

>Andrew Ford wrote:
>  
>
>>I have recently been putting refcards.com together again 
>>    
>>
>...snip...
>  
>
>>It still needs some work to finish it off, so any suggestions 
>>on how to fill the remaining space on the card, or 
>>corrections gratefully received.
>>    
>>
>
>Wow, this is fantastic. Below are a few things I have on my own "cheat
>sheet" that aren't on the refcard. Somebody holler if any of these are
>bogus.
>
>Virtual methods:
>scalar.chunk(size) # negative size chunks from R to L
>scalar.list # treat as a single-item list
>scalar.size # returns "1", as if it was single-item list
>
>hash.exists(key) # does key exist?
>hash.defined(key) # same as hash.key.defined?
>hash.size # number of pairs
>hash.item(key) # same as hash.key (when key is expression)
>hash.list # returns [ key1, val1, key2, val2, ... ]
>
>list.grep(re) # list of items matching re
>list.unique # list of unique elements, retains order
>list.merge(list1, [list2, ...] ) # combines all lists into new one
>list.slice(from, to) # returns subset
>list.splice(offset, len, [list]) # modifies list
>
>Special variable "loop" methods:
>size, index, prev, next
>
>Filters:
>html_entity # fix all entites, not just < and > (which is what "html"
>does)
>html_line_break # convert "newline" chars to <br>
>ucfirst
>lcfirst
>
>Also, some suggestions regarding directive syntax:
>[% INSERT filename %] # I don't think you can "insert" a block
>[% MACRO name[(varlist)] directive %] # optional "prototype" syntax for
>predeclaring variables to be localized in param list
>[% USE [var =] plugin[(params}] %] # optionally assign return value to a
>variable
>Maybe the [var = value ...] option could be added to the PROCESS and
>WRAPPER directives?
>
>Thanks for sharing this with us, it's a big help!
>Jason
>  
>

Added most of those corrections as well as a couple from Andy W, and 
have put a new version up on refcards.com.  I'll add the corrections I 
missed tomorrow (too tired to think now).

Andrew

        -- 
        Andrew Ford,  Director    Pauntley Prints / Ford & Mason Ltd
A.Ford@xxxxxxxxxx.xx.xx   South Wing, Compton House 
pauntley-prints.co.uk     Compton Green, Redmarley  Tel: +44 1531 829900
ford-mason.co.uk          Gloucester, GL19 3JB      Fax: +44 1531 829901
refcards.com/cronolog.org Great Britain          Mobile: +44 7785 258278


--------------050100060301020105020108
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Jason Gottshall wrote:
<blockquote
 cite="mid37C02BA0C03A6C46B81E07135754B8A8010C215E@xxxx.xx.xxxxxx.xxx"
 type="cite">
  <pre wrap="">Andrew Ford wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I have recently been putting refcards.com together again 
    </pre>
  </blockquote>
  <pre wrap=""><!---->...snip...
  </pre>
  <blockquote type="cite">
    <pre wrap="">It still needs some work to finish it off, so any suggestions 
on how to fill the remaining space on the card, or 
corrections gratefully received.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Wow, this is fantastic. Below are a few things I have on my own "cheat
sheet" that aren't on the refcard. Somebody holler if any of these are
bogus.

Virtual methods:
scalar.chunk(size) # negative size chunks from R to L
scalar.list # treat as a single-item list
scalar.size # returns "1", as if it was single-item list

hash.exists(key) # does key exist?
hash.defined(key) # same as hash.key.defined?
hash.size # number of pairs
hash.item(key) # same as hash.key (when key is expression)
hash.list # returns [ key1, val1, key2, val2, ... ]

list.grep(re) # list of items matching re
list.unique # list of unique elements, retains order
list.merge(list1, [list2, ...] ) # combines all lists into new one
list.slice(from, to) # returns subset
list.splice(offset, len, [list]) # modifies list

Special variable "loop" methods:
size, index, prev, next

Filters:
html_entity # fix all entites, not just &lt; and &gt; (which is what "html"
does)
html_line_break # convert "newline" chars to &lt;br&gt;
ucfirst
lcfirst

Also, some suggestions regarding directive syntax:
[% INSERT filename %] # I don't think you can "insert" a block
[% MACRO name[(varlist)] directive %] # optional "prototype" syntax for
predeclaring variables to be localized in param list
[% USE [var =] plugin[(params}] %] # optionally assign return value to a
variable
Maybe the [var = value ...] option could be added to the PROCESS and
WRAPPER directives?

Thanks for sharing this with us, it's a big help!
Jason
  </pre>
</blockquote>
<br>
Added most of those corrections as well as a couple from Andy W, and
have put a new version up on refcards.com.&nbsp; I'll add the corrections I
missed tomorrow (too tired to think now).<br>
<br>
Andrew<br>
<pre class="moz-signature" cols="72">-- 
Andrew Ford,  Director    Pauntley Prints / Ford &amp; Mason Ltd
<a class="moz-txt-link-abbreviated" href="mailto:A.Ford@xxxxxxxxxx.xx.xx">A.Ford@xxxxxxxxxx.xx.xx</a>;   South Wing, Compton House 
pauntley-prints.co.uk     Compton Green, Redmarley  Tel: +44 1531 829900
ford-mason.co.uk          Gloucester, GL19 3JB      Fax: +44 1531 829901
refcards.com/cronolog.org Great Britain          Mobile: +44 7785 258278
</pre>
</body>
</html>

--------------050100060301020105020108--

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] TT2 quick reference card
Andrew Ford 17:38 on 01 Jun 2004

Re: [Templates] TT2 quick reference card
Jeff Anderson 14:28 on 03 Jun 2004

Re: [Templates] TT2 quick reference card
Andy Wardley 14:47 on 03 Jun 2004

Re: [Templates] TT2 quick reference card
Andrew Ford 10:31 on 04 Jun 2004

Re: [Templates] TT2 quick reference card
Mark Mills 13:45 on 04 Jun 2004

Re: [Templates] TT2 quick reference card
Harry Jackson 13:55 on 04 Jun 2004

Re: [Templates] TT2 quick reference card
Mark Mills 14:09 on 04 Jun 2004

Re: [Templates] TT2 quick reference card
Andrew Ford 14:50 on 04 Jun 2004

Re: [Templates] TT2 quick reference card
Brett Sanger 15:21 on 04 Jun 2004

Re: [Templates] TT2 quick reference card
Dave Cross 13:49 on 04 Jun 2004

Re: [Templates] TT2 quick reference card
Andrew Ford 14:45 on 04 Jun 2004

RE: [Templates] TT2 quick reference card
Jason Gottshall 19:06 on 03 Jun 2004

Re: [Templates] TT2 quick reference card
Andrew Ford 20:47 on 03 Jun 2004

[Templates] refs and lists
crashkat (CrashKat) 23:53 on 03 Jun 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52