summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template.pm
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-02 02:54:28 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-02 02:54:28 +0000
commit17ce0a83d97bede1a166b9841be7b1348477189a (patch)
tree87dcf66115b0c1f026178fa95329dfbcb514a12f /LedgerSMB/Template.pm
parent3e4fbb3cc4fa116159b9d10735eda8a78e4b0736 (diff)
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
Diffstat (limited to 'LedgerSMB/Template.pm')
-rwxr-xr-xLedgerSMB/Template.pm27
1 files changed, 25 insertions, 2 deletions
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}+$/) {