From 17ce0a83d97bede1a166b9841be7b1348477189a Mon Sep 17 00:00:00 2001 From: tetragon Date: Tue, 2 Oct 2007 02:54:28 +0000 Subject: Adding format_options and output_options template constructor arguments Merging PDF and Postscript generation to the same file Adding DVI support git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1684 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Template.pm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'LedgerSMB/Template.pm') diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm index ad48ad52..672078c0 100755 --- a/LedgerSMB/Template.pm +++ b/LedgerSMB/Template.pm @@ -26,6 +26,16 @@ in string form or the name of the file that is the template to be processed. The format to be used. Currently HTML, PS, PDF, TXT and CSV are supported. +=item format_options (optional) + +A hash of format-specific options. See the appropriate LSMB::T::foo for +details. + +=item output_options (optional) + +A hash of output-specific options. See the appropriate output method for +details. + =item locale (optional) The locale object to use for regular gettext lookups. Having this option adds @@ -122,7 +132,6 @@ sub new { $self->{myconfig} = $args{user}; $self->{template} = $args{template}; $self->{format} = $args{format}; - $self->{format} = 'PS' if lc $self->{format} eq 'postscript'; $self->{language} = $args{language}; $self->{no_escape} = $args{no_escape}; $self->{debug} = $args{debug}; @@ -134,7 +143,21 @@ sub new { $self->{noauto} = $args{no_auto_output}; $self->{method} = $args{method}; $self->{method} ||= $args{media}; - + $self->{format_args} = $args{format_options}; + $self->{output_args} = $args{output_options}; + + # SC: Muxing pre-format_args LaTeX format specifications. Now with + # DVI support. + if (lc $self->{format} eq 'dvi') { + $self->{format} = 'LaTeX'; + $self->{format_args}{filetype} = 'dvi'; + } elsif (lc $self->{format} eq 'pdf') { + $self->{format} = 'LaTeX'; + $self->{format_args}{filetype} = 'pdf'; + } elsif (lc $self->{format} eq 'ps' or lc $self->{format} eq 'postscript') { + $self->{format} = 'LaTeX'; + $self->{format_args}{filetype} = 'ps'; + } bless $self, $class; if ($self->{format} !~ /^\p{IsAlnum}+$/) { -- cgit v1.2.3