Permalink
Browse files

*** empty log message ***

git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@78 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
1 parent 6642a76 commit 36ff03e20d78f5c28a134d414bc47bf115876fb3 @abw committed Dec 15, 2000
Showing with 6,035 additions and 3,239 deletions.
  1. +101 −1 Changes
  2. +8 −0 MANIFEST
  3. +2 −2 README
  4. +95 −3 TODO
  5. +27 −17 bin/ttree
  6. +1 −1 lib/Template.pm
  7. +2 −0 lib/Template/Base.pm
  8. +152 −43 lib/Template/Context.pm
  9. +102 −10 lib/Template/Directive.pm
  10. +2 −0 lib/Template/Document.pm
  11. +3,339 −3,068 lib/Template/Grammar.pm
  12. +73 −5 lib/Template/Parser.pm
  13. +398 −0 lib/Template/Plugin/Directory.pm
  14. +402 −0 lib/Template/Plugin/File.pm
  15. +87 −0 lib/Template/Plugin/View.pm
  16. +1 −1 lib/Template/Service.pm
  17. +121 −45 lib/Template/View.pm
  18. +5 −3 parser/Grammar.pm.skel
  19. +53 −12 parser/Parser.yp
  20. +20 −0 t/block.t
  21. +1 −1 t/compile3.t
  22. +262 −0 t/directry.t
  23. +156 −0 t/file.t
  24. +28 −2 t/filter.t
  25. +22 −0 t/include.t
  26. +24 −0 t/macro.t
  27. +19 −0 t/parser.t
  28. +74 −0 t/prefix.t
  29. +6 −9 t/provider.t
  30. +7 −0 t/tags.t
  31. +1 −0 t/test/src/complex
  32. +442 −14 t/view.t
  33. +1 −0 t/vmeth.t
  34. +1 −2 t/wrapper.t
View
102 Changes
@@ -17,7 +17,107 @@
#========================================================================
#------------------------------------------------------------------------
-# Version 2.00
+# Version 2.01 - snapshot 0.1
+#------------------------------------------------------------------------
+
+* Added the Template::View module, the VIEW directive and the View plugin
+ which can be used collectively to create dynamic views. This is a very
+ powerful tool which fulfills a number of requirements and makes possible
+ a number of things that have previously been messy, difficult or not
+ possible. Views are primarily collections of templates. You can define
+ BLOCKs within a view and they remain local to it, but can be called
+ from outside the view. This is still very experimental. Things are
+ likely to change. Take a look at t/view.t for examples.
+
+* Fixed the parser to accept expressions on the right hand side of
+ parameter definitions for INCLUDE, etc. e.g.
+
+ [% INCLUDE header
+ title = my_title or your_title or default_title
+ bgcol = (style == 'dark' ? '#000000' : '#ffffff')
+ %]
+
+* Added the facility to specify multiple templates within a PROCESS,
+ INCLUDE, INSERT or WRAPPER directive. For all but WRAPPER, the
+ templates are processed in the order specified.
+
+ [% PROCESS config + header + menu %]
+ [% INCLUDE section/break + html/titlebar
+ title='A New Section'
+ %]
+ [% WRAPPER edge + box + titlebar %]
+ ...
+ [% END %]
+
+ Multiple WRAPPER templates get processed in reverse order to create
+ the correct nesting effect. In the example above, the enclosed block
+ is processed and passed to 'titlebar' which wraps it and passes the
+ output to 'header' which wraps it and passes the output to 'box', which
+ wraps it and passes the output to 'edge' which wraps it and returns the
+ output. Thus the specification order is outermost to innermost, but
+ they are actually processed from the inside out.
+
+* Templates specified to INCLUDE, PROCESS, WRAPPER and INSERT can now
+ be given a prefix (delimited by ':', as in "file:blahblah.txt" or
+ "http://www.tt2.org/index.html", for example) which maps them to a
+ particular template provider or providers. A PREFIX_MAP
+ configuration option can be specified as a hash array mapping prefix
+ names to a reference to a list of providers. For convenience, you
+ can also specify the argument as a string of integers, delimited by
+ any non-numerical sequence, to indicate indices into the LOAD_TEMPLATES
+ provider list. e.g.
+
+ my $template = Template->new({
+ LOAD_TEMPLATES => [ $foo, $bar, $baz, $wiz ],
+ PREFIX_MAP => {
+ src => '0, 2', # $foo and $baz
+ lib => '1, 2', # $bar and $baz
+ all => '0, 1, 2', # $foo, $bar and $baz
+ }
+ });
+
+ Thus [% INCLUDE src:hello.tt2 %] indicates the 'hello.tt2' template
+ to be provided by $foo or $baz, [% INCLUDE lib:hello.tt2 %] is mapped
+ to $bar and $baz, [% INCLUDE all:hello.tt2 %] can be provided by
+ $foo, $bar or $baz, and the default [% INCLUDE hello.tt2 %] is
+ mapped to the entire LOAD_TEMPLATES list: $foo, $bar, $baz and $wiz.
+ This is initially useful for things like ttree which would like a way
+ to differentiate between templates in one place and templates in
+ another. It can also be used, of course, to provider special providers
+ for certain file type, as in http://fetch.some.file.com/blah/blah/...
+
+* I *think* I identified the bug whereby non-exception objects were
+ be raised, causing an error in Template::Service...
+
+* Added the 'indent' filter to indent a block by prefixing each line with
+ a specified string, or a number of spaces when the argument is numerical.
+
+* Added tag style 'star' of the form [* ... *]
+
+* Fixed a bug in Template::Stash which was raising an error when an
+ element on the left hand side of a '.' evaluated to a defined, but
+ empty value.
+
+* Fixed an obscure bug in Template::Stash which occurred when calling
+ a scalar method on a value which contained a valid and visible object
+ package name. e.g. [% name = 'Foo::Bar'; name.baz() %] called
+ Foo::Bar->baz().
+
+* Fixed another obscure bug, this time in Template::Parser which wasn't
+ chomping the final newline in the input string. Thanks to Paul
+ Makepeace for reporting the problem.
+
+* Removed some old "delegate-to-another-object" code from Template::Plugin,
+ including a nasty AUTOLOAD method which prevented derived objects from
+ acting as transparent hashes. If delegative functionality is required
+ then it should be implemented as Template::Plugin::Delegate (and may
+ well be in the fullness of time).
+
+* Fixed a whole bunch of typos and spellos thanks to a patch from Leon.
+
+
+#------------------------------------------------------------------------
+# Version 2.00 1st December 2000
#------------------------------------------------------------------------
* Added the repeat(n), search(pattern) and replace(search, replace)
View
@@ -35,7 +35,9 @@ lib/Template/Plugin/CGI.pm
lib/Template/Plugin/DBI.pm
lib/Template/Plugin/Datafile.pm
lib/Template/Plugin/Date.pm
+lib/Template/Plugin/Directory.pm
lib/Template/Plugin/Dumper.pm
+lib/Template/Plugin/File.pm
lib/Template/Plugin/Format.pm
lib/Template/Plugin/Iterator.pm
lib/Template/Plugin/Table.pm
@@ -55,6 +57,7 @@ lib/Template/Stash.pod
lib/Template/Test.pm
lib/Template/Test.pod
lib/Template/Tutorial.pod
+lib/Template/View.pm
parser/Grammar.pm.skel
parser/Parser.yp
parser/README
@@ -79,13 +82,15 @@ t/datafile.t
t/date.t
t/dbi.t
t/directive.t
+t/directry.t
t/document.t
t/dom.t
t/dumper.t
t/error.t
t/evalperl.t
t/exception.t
t/filter.t
+t/file.t
t/foreach.t
t/format.t
t/include.t
@@ -96,6 +101,8 @@ t/object.t
t/output.t
t/parser.t
t/plugins.t
+t/plusfile.t
+t/prefix.t
t/process.t
t/provider.t
t/ref.t
@@ -148,6 +155,7 @@ t/try.t
t/url.t
t/vars.t
t/varsv1.t
+t/view.t
t/vmeth.t
t/while.t
t/wrap.t
View
4 README
@@ -1,8 +1,8 @@
Template Toolkit
- Version 2.00-rc2
+ Version 2.00
- 14th November 2000
+ 1st December 2000
Copyright (C) 1996-2000 Andy Wardley. All Rights Reserved
Copyright (C) 1998-2000 Canon Research Centre Europe Ltd.
View
98 TODO
@@ -1,6 +1,12 @@
The following lists detail pending items, known bugs and possible future
enhancements planned for the Template Toolkit.
+LATEST
+------
+
+* Fix Template::DBI iterator first/last() - it doesn't behave the same as
+ list first/last() and get_all() fails?
+
#------------------------------------------------------------------------
# PENDING
@@ -25,14 +31,22 @@ enhancements planned for the Template Toolkit.
working on a POD to Template translator that will allow you to
convert any POD documents (include the TT docs, of course) into TT
templates that can then be processed into virtually any other format
- or style.
+ or style. There's a working prototype of this system if anyone wants
+ to take a look at it. Ask me for the code if you're interested and
+ don't mind a few rough edges.
+
+* The File and Directory plugins have grown out of a Directory plugin
+ that Michael Stevens <michael@etla.org> wrote and posted to the list.
+ I need to post my changes back to Michael and the list and see what
+ people think and where they can be improved.
* Template Toolkit FAQ.
* Template::Internals. A document about the internals describing how,
where and why to hack on them.
-* "Camelot!", "Camelot!", "Camelot!". "It's only a model".
+* "Camelot!", "Camelot!", "Camelot!" (It's only a model). See
+ http://www.template-toolkit.org/camelot/ for further info.
#------------------------------------------------------------------------
@@ -86,8 +100,78 @@ enhancements planned for the Template Toolkit.
# foo <- this gets printed
%]
+
#------------------------------------------------------------------------
-# FUTURE ENHANCEMENTS
+# LATEST THOUGHTS
+#
+# These are some of the latest ideas.
+#------------------------------------------------------------------------
+
+* Template::View, to implement dynamic views.
+ (this is now underway - see Template::View, and Views.pod somewhere
+ in the manual section of docs (under construction).
+
+* Ability to set different parser options for BLOCK definitions, etc.
+ See P2.pm - got half a lexer working.
+
+ [% BLOCK header
+ eval_perl = 0
+ pre_chomp = 1
+ %]
+ ...
+ [% END %]
+
+ Anonymous BLOCK can then be used to set a parser scope
+
+ [% BLOCK trim=1 %]
+
+ [% END %]
+
+ [% BLOCK trim=0 %]
+
+ [% END %]
+
+ And/or set different tag styles, etc.
+
+ [% BLOCK tags='star' %]
+ [* INCLUDE this_is_a_directive *]
+ [% INCLUDE this_is_not %]
+ [* END *]
+
+ [% INCLUDE back_to_normal %]
+
+ This will require some fairly serious work on the parser.
+
+* Template::Component, kind of compimentary to Template::View.
+ It should be possible to create a component object which
+ encapsulates pure Perl application logic with output templates,
+ managed by a related Template::View. HTML::Mason is most definately
+ the inspiration for this. For example, we might like to define
+ components on a per-directory basis. A directory might contain a
+ Perl module or modules which encode application logic, and one or
+ more templates which represent the view elements.
+
+ /usr/local/tt2/components/Mailbox/
+ Mailbox.pm
+ header
+ footer
+ title
+ or
+
+ /usr/local/tt2/components/Mailbox/
+ perl/
+ Mailbox.pm
+ Reader.pm
+ Writer.pm
+ Blah/Blah.pm
+ template/
+ header
+ footer
+ title
+ config.xml
+
+#------------------------------------------------------------------------
+# POSSIBLE FUTURE ENHANCEMENTS (the less recent thoughts)
#
# Things that might get added to a future release.
#------------------------------------------------------------------------
@@ -173,4 +257,12 @@ enhancements planned for the Template Toolkit.
that we will be able to incorporate some of those ideas some time
soon.
+#------------------------------------------------------------------------
+# misc
+#------------------------------------------------------------------------
+
+* default DELIMITER should be defined as a package var somewhere. It's
+ currently hardcoded in Template::Parser and Template::Context.
+
+* CVS add plusfile.t, prefix.t, ...
Oops, something went wrong.

0 comments on commit 36ff03e

Please sign in to comment.