[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1584] trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb: [1584] trunk/LedgerSMB
- From: ..hidden..
- Date: Thu, 13 Sep 2007 10:45:30 -0700
Revision: 1584
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1584&view=rev
Author: tetragon
Date: 2007-09-13 10:45:30 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
Adding a debug flag
Modified Paths:
--------------
trunk/LedgerSMB/Template/CSV.pm
trunk/LedgerSMB/Template/HTML.pm
trunk/LedgerSMB/Template/PDF.pm
trunk/LedgerSMB/Template/PS.pm
trunk/LedgerSMB/Template/TXT.pm
trunk/LedgerSMB/Template.pm
Modified: trunk/LedgerSMB/Template/CSV.pm
===================================================================
--- trunk/LedgerSMB/Template/CSV.pm 2007-09-13 17:06:15 UTC (rev 1583)
+++ trunk/LedgerSMB/Template/CSV.pm 2007-09-13 17:45:30 UTC (rev 1584)
@@ -81,6 +81,8 @@
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
+ DEBUG => ($parent->{debug})? 'dirs': undef,
+ DEBUG_FORMAT => '',
}) || throw Error::Simple Template->error();
if (not $template->process(
Modified: trunk/LedgerSMB/Template/HTML.pm
===================================================================
--- trunk/LedgerSMB/Template/HTML.pm 2007-09-13 17:06:15 UTC (rev 1583)
+++ trunk/LedgerSMB/Template/HTML.pm 2007-09-13 17:45:30 UTC (rev 1584)
@@ -75,12 +75,14 @@
my $parent = shift;
my $cleanvars = shift;
my $template;
-
+
$template = Template->new({
INCLUDE_PATH => $parent->{include_path},
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
+ DEBUG => ($parent->{debug})? 'dirs': undef,
+ DEBUG_FORMAT => '',
}) || throw Error::Simple Template->error();
if (not $template->process(
get_template($parent->{template}),
Modified: trunk/LedgerSMB/Template/PDF.pm
===================================================================
--- trunk/LedgerSMB/Template/PDF.pm 2007-09-13 17:06:15 UTC (rev 1583)
+++ trunk/LedgerSMB/Template/PDF.pm 2007-09-13 17:45:30 UTC (rev 1584)
@@ -81,6 +81,8 @@
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';'
+ DEBUG => ($parent->{debug})? 'dirs': undef,
+ DEBUG_FORMAT => '',
}) || throw Error::Simple Template::Latex->error();
if (not $template->process(
Modified: trunk/LedgerSMB/Template/PS.pm
===================================================================
--- trunk/LedgerSMB/Template/PS.pm 2007-09-13 17:06:15 UTC (rev 1583)
+++ trunk/LedgerSMB/Template/PS.pm 2007-09-13 17:45:30 UTC (rev 1584)
@@ -81,6 +81,8 @@
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
+ DEBUG => ($parent->{debug})? 'dirs': undef,
+ DEBUG_FORMAT => '',
}) || throw Error::Simple Template::Latex->error();
if (not $template->process(
Modified: trunk/LedgerSMB/Template/TXT.pm
===================================================================
--- trunk/LedgerSMB/Template/TXT.pm 2007-09-13 17:06:15 UTC (rev 1583)
+++ trunk/LedgerSMB/Template/TXT.pm 2007-09-13 17:45:30 UTC (rev 1584)
@@ -62,6 +62,8 @@
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
+ DEBUG => ($parent->{debug})? 'dirs': undef,
+ DEBUG_FORMAT => '',
}) || throw Error::Simple Template->error();
if (not $template->process(
Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm 2007-09-13 17:06:15 UTC (rev 1583)
+++ trunk/LedgerSMB/Template.pm 2007-09-13 17:45:30 UTC (rev 1584)
@@ -11,18 +11,59 @@
=over
-=item new(user => \%myconfig, template => $string, format => 'HTML', [language => $string,] [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool]] );
+=item new(user => \%myconfig, template => $string, format => $string, [language => $string], [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool], [debug => $bool] );
This command instantiates a new template:
-template is the file name of the template to be processed.
-format is the type of format to be used. Currently only HTML is supported
-language (optional) specifies the language for template selection.
-include_path allows one to override the template directory and use this with user interface templates.
-no_auto_output disables the automatic output of rendered templates.
-no_escape disables escaping on the template variables.
-method is the output method to use, defaults to HTTP
-media is a synonym for method
+=over
+
+=item template
+
+The name of the template file to be processed.
+
+=item format
+
+The format to be used. Currently HTML, PS, PDF, TXT and CSV are supported.
+
+=item language (optional)
+
+The language for template selection.
+
+=item include_path (optional)
+
+Overrides the template directory. Used with user interface templates.
+
+=item no_auto_output (optional)
+
+Disables the automatic output of rendered templates.
+
+=item no_escape (optional)
+
+Disables escaping on the template variables.
+
+=item debug (optional)
+
+Enables template debugging.
+
+With the TT-based renderers, HTML, PS, PDF, TXT, and CSV, the portion of the
+template to get debugging messages is to be surrounded by
+<?lsmb DEBUG format 'foo' ?> statements. Example:
+
+ <tr><td colspan="<?lsmb columns.size ?>"></td></tr>
+ <tr class="listheading">
+ <?lsmb FOREACH column IN columns ?>
+ <?lsmb DEBUG format '$file line $line : [% $text %]' ?>
+ <th class="listtop"><?lsmb heading.$column ?></th>
+ <?lsmb DEBUG format '' ?>
+ <?lsmb END ?>
+ </tr>
+
+=item method/media (optional)
+
+The output method to use, defaults to HTTP. Media is a synonym for method
+
+=back
+
=item render($hashref)
This command renders the template and writes the result to standard output.
@@ -64,6 +105,7 @@
$self->{format} = 'PS' if lc $self->{format} eq 'postscript';
$self->{language} = $args{language};
$self->{no_escape} = $args{no_escape};
+ $self->{debug} = $args{debug};
if ($args{outputfile}) {
$self->{outputfile} =
"${LedgerSMB::Sysconfig::tempdir}/$args{outputfile}";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.