[Templates] Cookbook Status

Andy Wardley abw@kfs.org
Tue, 12 Mar 2002 15:29:08 +0000


On Mon, Mar 11, 2002 at 11:38:42AM +0000, Mark Fowler wrote:
> What's the status with the cookbook atm?  Should I just write something,
> or is there a template I should be using, etc, etc.

Write it now!

Anyone, and I mean anyone, is more than welcome to write a tutorial on
any subject relating to the Template Toolkit and I'll gladly include it
with the distribution.

Here's how:

 1) First fetch the docsrc bundle from tt2.org and unpack in a TT2
    distribution directory.

 2) Write your tutorial as docsrc/src/Tutorial/XPath.tt2 (or some other name)
    Don't bother adding any of the footers (e.g. copyright, author, etc.)
    - they get added automatically.  See Datafile.tt2 - this also shows how
    you can insert the <intro>...</intro> section from the XML file (next
    step).

      [% TAGS star -%]
      =head1 DESCRIPTION

      [* USE wrap; page.intro | wrap(72) *]

      =head1 How to do cool stuff with the XPath plugin

      Yah yah yah the XPath plugin...


 3) Edit docsrc/xml/ttdocs.xml copying a previous tutorial (e.g. Dave's
    Datafile) and change the details accordingly.

	<!-- Template::Tutorial::XPath -->
	<page id="XPath"
	      standalone="1"
	      about="Using the Template Toolkit XML XPath Plugin"
	      author="mark" 
              copyright="2002">
	    <intro>
              This tutorial shows how to use the XML XPath plugin...
	    </intro>
	</page>

 4) Add yourself as an author to docsrc/lib/authors to match the 'author'
    attribute in the XML file

	mark = {
	    name  = 'Mark Fowler' 
	    email = 'mark.fowler@indicosoftware.com'
	}

 5) run docsrc/bin/ttmkdocs

 6) perldoc docsrc/pod/Template/Tutorial/XPath.pod to see the results

 7) Send me patches, sit back and have a beer.  You're now an official
    Template Toolkit documentation author and you've earned it.  :-)
    

A