Permalink
Browse files

*** empty log message ***

git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@101 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
1 parent a103e55 commit f8656e482e10d17cb942d77793a09fbe87e46c7e @abw committed Mar 29, 2001
Showing with 1,279 additions and 399 deletions.
  1. +1 −40 MANIFEST
  2. +0 −72 docsrc/README
  3. +2 −2 lib/Template.pm
  4. +1 −1 lib/Template/Base.pm
  5. +20 −1 lib/Template/Config.pm
  6. +1 −1 lib/Template/Constants.pm
  7. +1 −1 lib/Template/Context.pm
  8. +1 −1 lib/Template/Document.pm
  9. +1 −1 lib/Template/Exception.pm
  10. +1 −1 lib/Template/FAQ.pod
  11. +4 −9 lib/Template/Filters.pm
  12. +1 −1 lib/Template/Iterator.pm
  13. +33 −13 lib/Template/Library/HTML.pod
  14. +1 −1 lib/Template/Library/PostScript.pod
  15. +572 −194 lib/Template/Library/Splash.pod
  16. +3 −5 lib/Template/Manual.pod
  17. +1 −1 lib/Template/Manual/Config.pod
  18. +4 −3 lib/Template/Manual/Credits.pod
  19. +4 −4 lib/Template/Manual/Directives.pod
  20. +2 −2 lib/Template/Manual/Filters.pod
  21. +1 −1 lib/Template/Manual/Internals.pod
  22. +1 −1 lib/Template/Manual/Intro.pod
  23. +1 −1 lib/Template/Manual/Plugins.pod
  24. +1 −1 lib/Template/Manual/Refs.pod
  25. +1 −1 lib/Template/Manual/Syntax.pod
  26. +1 −1 lib/Template/Manual/Variables.pod
  27. +1 −1 lib/Template/Manual/Views.pod
  28. +5 −3 lib/Template/Modules.pod
  29. +1 −1 lib/Template/Parser.pm
  30. +6 −6 lib/Template/Plugin.pm
  31. +1 −1 lib/Template/Plugin/Autoformat.pm
  32. +1 −1 lib/Template/Plugin/CGI.pm
  33. +1 −1 lib/Template/Plugin/Datafile.pm
  34. +1 −1 lib/Template/Plugin/Date.pm
  35. +1 −1 lib/Template/Plugin/Directory.pm
  36. +1 −1 lib/Template/Plugin/Dumper.pm
  37. +1 −1 lib/Template/Plugin/File.pm
  38. +1 −1 lib/Template/Plugin/Format.pm
  39. +1 −1 lib/Template/Plugin/Iterator.pm
  40. +103 −0 lib/Template/Plugin/Pod.pm
  41. +1 −1 lib/Template/Plugin/Table.pm
  42. +1 −1 lib/Template/Plugin/URL.pm
  43. +1 −1 lib/Template/Plugin/View.pm
  44. +1 −1 lib/Template/Plugin/Wrap.pm
  45. +1 −1 lib/Template/Plugin/XML/DOM.pm
  46. +1 −1 lib/Template/Plugin/XML/RSS.pm
  47. +123 −0 lib/Template/Plugin/XML/Simple.pm
  48. +1 −1 lib/Template/Plugin/XML/XPath.pm
  49. +1 −1 lib/Template/Plugins.pm
  50. +1 −1 lib/Template/Provider.pm
  51. +1 −1 lib/Template/Service.pm
  52. +1 −1 lib/Template/Stash.pm
  53. +1 −1 lib/Template/Test.pm
  54. +1 −1 lib/Template/Tools/tpage.pod
  55. +1 −1 lib/Template/Tools/ttree.pod
  56. +1 −1 lib/Template/Tutorial.pod
  57. +3 −2 parser/Parser.yp
  58. +26 −1 t/config.t
  59. +29 −0 t/filter.t
  60. +36 −1 t/leak.t
  61. +75 −0 t/pod.t
  62. +126 −0 t/test/pod/test1.pod
  63. +20 −0 t/text.t
  64. +28 −0 t/try.t
  65. +13 −0 t/vmeth.t
View
@@ -96,46 +96,7 @@ docs/style/splash/menu
docs/style/splash/navigate
docs/style/splash/pagemenu
docs/style/splash/section
-examples/html/html/bar.html
-examples/html/html/bars.html
-examples/html/html/box.html
-examples/html/html/button.html
-examples/html/html/colors.html
-examples/html/html/edgebar.html
-examples/html/html/edgebox.html
-examples/html/html/headers.html
-examples/html/html/indent.html
-examples/html/html/index.html
-examples/html/html/link.html
-examples/html/html/links.html
-examples/html/html/list.html
-examples/html/html/lists.html
-examples/html/html/menu.html
-examples/html/html/menubar.html
-examples/html/html/menus.html
-examples/html/html/paras.html
-examples/html/html/rgb.html
-examples/html/html/tables.html
-examples/html/html/test.html
-examples/html/ps/index.html
-examples/html/ps/marks.html
-examples/html/splash/box.html
-examples/html/splash/button.html
-examples/html/splash/buttons.html
-examples/html/splash/config.html
-examples/html/splash/dropbox.html
-examples/html/splash/index.html
-examples/html/splash/menu.html
-examples/html/splash/menus.html
-examples/html/splash/panel.html
-examples/html/splash/pulldown.html
-examples/html/splash/tabbox.html
-examples/html/splash/table.html
-examples/html/splash/tabs.html
-examples/html/splash/tabsbox.html
-examples/html/splash/tabset.html
-examples/html/splash/tabsets.html
-examples/html/splash/text.html
+examples/html/README
examples/lib/README
examples/lib/config
examples/lib/example/README
View
@@ -1,72 +0,0 @@
-This directory contains the source templates, components and
-configuration file for building the HTML documentation.
-
- README This file
- config ttree configuration files
- html destination directory for generated HTML pages
- lib library of common template elements for building docs
- src source templates for documentation
- style style-specific libraries of template elements
-
-The 'config' directory contains a default ttree configuration file,
-'default.cfg', which is automatically generated at installation time
-(when the Makefile.PL is run). It contains values based on those
-specified for the TT2 installation directory and desired style, one of
-'plain' or 'splash'.
-
-If the user requests it, then the HTML documentation is built at run
-time when the "make install" happens. This is achieved by calling
-ttree and specifying the config file via the -f option. Something
-like this:
-
- $ ttree -f /usr/local/tt2/docs/config/default.cfg
-
-All the source templates are in the 'src' directory. These are generated
-automatically from the POD documentation which itself is built from a
-separate set of TT2 templates, XML, Perl scripts and other magical bits
-and pieces. The 'docsrc' bundle is distributed separately from the
-main Template Toolkit distribution. It's available from the TT2 web site,
-at http://www.template-toolkit.org/docs/ if you're interested in seeing
-how that fits together, or if you want to do some work on the docs.
-
-The 'lib' directory contains some general purpose template elements
-and also an automatically generated configuration file 'docset/config'
-which describes the structure and metadata for all the pages. The
-templates use this to correctly set menu links, cross-references, etc.,
-between pages.
-
-The 'style' directory contains style-specific elements in 'plain' or
-'splash' formats. You can copy these and create your own styles if
-you like.
-
- $ cp -R style/plain style/my_style_a
-
-Then you can copy the default ttree config file to one of your own
-and edit accordingly
-
- $ cp config/default.cfg config/my_style_a.cfg
-
-To build the HTML in your own style you simply call ttree and specify
-your own configuration file.
-
- $ ttree -f /usr/local/tt2/docs/config/my_style_a.cfg
-
-The 'html' directory is the default location for the generated HTML
-files, but you could, of course, change your ttree configuration file
-to send it wherever you like.
-
-Don't forget that you can specify as many 'lib' options in the
-configuration file as you like. e.g.
-
- lib = /usr/local/tt2/docs/style/my_style_b
- lib = /usr/local/tt2/docs/style/splash
-
-So rather than copy an existing style, you might prefer to create a
-new, empty style directory (e.g. my_style_b) in which you create new
-elements which are then used in preference to those in the other style(s)
-(e.g. splash).
-
-All the pages use relative links to reference each other, so you can
-safely copy the generated HTML pages anywhere you like, symlink to it,
-or do whatever else you need to do to make the pages visible to your
-web server.
View
@@ -866,7 +866,7 @@ Define new tag style or characters (default: [% %]).
=item COMMENTS
Ignored and deleted.
-
+
[% # this is a comment to the end of line
foo = 'bar'
%]
@@ -885,7 +885,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
View
@@ -212,7 +212,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
View
@@ -34,7 +34,6 @@ use vars qw( $VERSION $DEBUG $ERROR $INSTDIR
$VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
$DEBUG = 0 unless defined $DEBUG;
$ERROR = '';
-$INSTDIR = '';
$CONTEXT = 'Template::Context';
$FILTERS = 'Template::Filters';
$ITERATOR = 'Template::Iterator';
@@ -44,6 +43,9 @@ $PROVIDER = 'Template::Provider';
$SERVICE = 'Template::Service';
$STASH = 'Template::Stash';
+# the following is set at installation time by the Makefile.PL
+$INSTDIR = '/usr/local/tt2';
+
#========================================================================
# --- CLASS METHODS ---
#========================================================================
@@ -343,6 +345,23 @@ Returns an object reference or undef on error, as above.
Instantiate a new template service object (default: Template::Service).
Returns an object reference or undef on error, as above.
+=head2 instdir($dir)
+
+Returns the root directory of the Template Toolkit installation under
+which optional components are installed. Any relative directory specified
+as an argument will be appended to the returned directory.
+
+ # e.g. returns '/usr/local/tt2'
+ my $ttroot = Template::Config->instdir()
+ || die "$Template::Config::ERROR\n";
+
+ # e.g. returns '/usr/local/tt2/templates'
+ my $template = Template::Config->instdir('templates')
+ || die "$Template::Config::ERROR\n";
+
+Returns undef and sets $Template::Config::ERROR appropriately if the
+optional components of the Template Toolkit have not been installed.
+
=head1 AUTHOR
Andy Wardley E<lt>abw@kfs.orgE<gt>
@@ -159,7 +159,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
View
@@ -1404,7 +1404,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
View
@@ -442,7 +442,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
@@ -225,7 +225,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
View
@@ -120,7 +120,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
View
@@ -388,8 +388,8 @@ sub perl_filter_factory {
return sub {
my $text = shift;
- $Template::Perl::context = $context;
- $Template::Perl::stash = $stash;
+ local($Template::Perl::context) = $context;
+ local($Template::Perl::stash) = $stash;
my $out = eval <<EOF;
package Template::Perl;
\$stash = \$context->stash();
@@ -420,11 +420,6 @@ sub redirect_filter_factory {
my $outpath = $context->config->{ OUTPUT_PATH }
|| return '';
$outpath .= "/$file";
-# local *FP;
-# open(FP, ">$outpath")
-# || die Template::Exception->new('file', "$file: $!");
-# print FP $text;
-# close(FP);
my $error = Template::_output($outpath, $text);
die Template::Exception->new('redirect', $error)
if $error;
@@ -673,7 +668,7 @@ output:
Folds the input to lower case.
- [% "Hello World" | FILTER upper %]
+ [% "Hello World" | FILTER lower %]
output:
@@ -915,7 +910,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
View
@@ -427,7 +427,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
@@ -39,9 +39,31 @@ Template::Library::HTML - Template library for basic HTML pages
=head1 DESCRIPTION
+B<NOTE:> This documentation is incomplete and may be incorrect
+in places.
+
The 'html' template library is distributed as part of the Template
Toolkit. It can be found in the 'templates' sub-directory of the
-distribution directory.
+installation directory.
+
+ use Template;
+
+ my $tt2 = Template->new({
+ INCLUDE_PATH => '/usr/local/tt2/templates',
+ });
+
+For a portable way to determine the installation 'templates' directory,
+you can use the C<Template::Config-E<gt>instdir()> class method.
+
+ use Template;
+
+ my $tt2 = Template->new({
+ INCLUDE_PATH => Template::Config->instdir('templates'),
+ });
+
+You should now be able to access the html library as, for example:
+
+ [% INCLUDE html/header %]
Note that some of the more basic elements don't give you much more
than the raw HTML tags. In many cases you might be well advised to
@@ -82,18 +104,20 @@ E<lt>htmlE<gt> to the opening E<lt>bodyE<gt>.
bgcol = '#ffffff'
%]
-Additional header items can be provided by explicitly setting the 'content'
-variable, or by use of the WRAPPER directive.
+Additional header items can be provided by explicitly setting the 'headers'
+variable, e.g.
- [% WRAPPER html/header
- title = 'This is a Test'
- bgcol = '#ffffff'
- %]
+ [% headers = BLOCK %]
<META name="description" content="Template Toolkit">
<META name="REVISIT-AFTER" content="14 days">
<META name="keywords" content="Templates, Web, ...etc...">
[% END %]
+ [% INCLUDE html/header
+ title = 'This is a Test'
+ bgcol = '#ffffff'
+ %]
+
=item footer
The 'footer' element generates the terminating E<lt>/bodyE<gt> and
@@ -110,7 +134,7 @@ E<lt>/htmlE<gt> element to balance the header.
The 'page' element combines the 'html/header' and 'html/footer' elements.
[% WRAPPER html/page %]
-
+
...page content here...
[% END %]
@@ -253,10 +277,6 @@ The box element is a wrapping of html/table + html/row + html/cell
Hello World!
[% END %]
-=item panel
-
-TODO
-
=back
=head1 AUTHOR
@@ -267,7 +287,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
@@ -51,7 +51,7 @@ L<http://www.andywardley.com/|http://www.andywardley.com/>
=head1 VERSION
-Template Toolkit version 2.01, released on 9th March 2000.
+Template Toolkit version 2.01, released on 28th March 2001.
=head1 COPYRIGHT
Oops, something went wrong.

0 comments on commit f8656e4

Please sign in to comment.