[Templates] tpage output_path
hello all, i just spent a long and hard time ;-) to produce the current patch that add the --output_path=DIRDirectory into which output files can be written (using redirect filter) to tpage. I also notice that there are undocumented parameters. Are doc/usage pages welcomed? regards -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com Index: bin/tpage === --- bin/tpage (révision 1112) +++ bin/tpage (copie de travail) @@ -109,6 +109,7 @@ 'template_tag_style|tag_style|tagstyle=s', 'template_compile_ext|compile_ext=s', 'template_compile_dir|compile_dir=s', +'template_output_path|output_path|o=s', 'template_plugin_base|plugin_base|pluginbase=s@', 'perl5lib|perllib=s@' ); @@ -151,6 +152,7 @@ --absolute Allow ABSOLUTE directories (enabled by default) --relative Allow RELATIVE directories (enabled by default) --include_path=DIR Add directory to INCLUDE_PATH + --output_path=DIRDirectory into which output files can be written (using redirect filter) --pre_process=TEMPLATE Process TEMPLATE before each main template --post_process=TEMPLATE Process TEMPLATE after each main template --process=TEMPLATE Process TEMPLATE instead of main template ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates
[Templates] register vmethods?
hello, I tried to register a vmethod to an object using this way: use strict; use warnings; use Template; use Template::Stash; $Template::Stash::SCALAR_OPS-{field} = sub { my $self = shift; $self-field(@_); } but it doesn't work: $self can't be a reference to be handled by SCALAR_OPS. I have 2 questions about it: i use Template::Stash, so i guess that XS isn't used anymore in my script so i lost performance. is it right? is it a way to handle a vmethod for an object without using USE or declare anything (everything is done in the perl code)? I just want something as simple as [% notice.field('99'); %] -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] register vmethods?
hello Sean, I'm afraid it does the same ... On Mon, Jul 28, 2008 at 11:26:05AM -0700, Sean McAfee wrote: sub Foo::field { $_[1] } $Template::Stash::HASH_OPS-{foo} = sub { shift-field(@_) }; Template-new-process(\[% x.foo(42) %], { x = bless({ }, 'Foo' }); -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] register vmethods?
Sean, On Tue, Jul 29, 2008 at 12:13:03AM +0200, Marc Chantreux wrote: hello Sean, I'm afraid it does the same ... I was afraid for nothing: it works fine. Additionnaly, it is very simple to add methods using Template::Plugin::VMethods. many thanks for help regards -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] register vmethods?
Josh, On Wed, Jul 30, 2008 at 10:03:14AM -0600, Josh Rosenbaum wrote: More details here: http://template-toolkit.org/docs/modules/Template/Stash/XS.html thanks for explainations and pointing this link! [% notice.field('99'); %] I'd just add a method to the object, do you mean that if notice isa('MARC::Record'), TT2 uses MARC::Record::field by defaut ? regards -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] Evaluate a TT variable that contain a TT string
On Thu, Nov 26, 2009 at 12:57:18PM +0100, Harald Joerg wrote: Is it possible to interpret somehow page_body variable to be processed like a template? why just not PROCESS data file ? do you plane to generate templates on fly ? that means you can't cache and i imagine you can have serious performance issues. isn't it possible to write functions (BLOCK) and WRAPPERs ? regards -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] Evaluate a TT variable that contain a TT string
On Thu, Nov 26, 2009 at 04:01:16PM +0200, Octavian Râsnita wrote: No I don't generate templates dynamicly, but if I put just simple html code in the database You store things it database, that's why! i got it now and it makes sense. regards -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates