Revision 1b9d0f70
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
SL/Template/LaTeX.pm | ||
---|---|---|
17 | 17 |
|
18 | 18 |
sub format_string { |
19 | 19 |
my ($self, $variable) = @_; |
20 |
my $form = $self->{"form"}; |
|
21 | 20 |
|
22 | 21 |
$variable = $main::locale->quote_special_chars('Template/LaTeX', $variable); |
23 | 22 |
|
... | ... | |
257 | 256 |
if ($key eq 'tag-style') { |
258 | 257 |
$self->set_tag_style(split(m/\s+/, $value, 2)); |
259 | 258 |
} |
259 |
if ($key eq 'use-template-toolkit') { |
|
260 |
$self->set_use_template_toolkit($value); |
|
261 |
} |
|
260 | 262 |
} |
261 | 263 |
|
262 | 264 |
sub _parse_config_lines { |
... | ... | |
350 | 352 |
|
351 | 353 |
$self->{"forced_pagebreaks"} = []; |
352 | 354 |
|
353 |
my $new_contents = $self->parse_block($contents); |
|
355 |
my $new_contents; |
|
356 |
if ($self->{use_template_toolkit}) { |
|
357 |
my $additional_params = $::form; |
|
358 |
|
|
359 |
$::form->init_template->process(\$contents, $additional_params, \$new_contents) || die $::form->template->error; |
|
360 |
} else { |
|
361 |
$new_contents = $self->parse_block($contents); |
|
362 |
} |
|
354 | 363 |
if (!defined($new_contents)) { |
355 | 364 |
$main::lxdebug->leave_sub(); |
356 | 365 |
return 0; |
SL/Template/OpenDocument.pm | ||
---|---|---|
260 | 260 |
$contents =~ s|</office:automatic-styles>|${new_styles}</office:automatic-styles>|; |
261 | 261 |
$contents =~ s|[\n\r]||gm; |
262 | 262 |
|
263 |
my $new_contents = $self->parse_block($contents); |
|
263 |
my $new_contents; |
|
264 |
if ($self->{use_template_toolkit}) { |
|
265 |
my $additional_params = $::form; |
|
266 |
|
|
267 |
$::form->init_template->process(\$contents, $additional_params, \$new_contents) || die $::form->template->error; |
|
268 |
} else { |
|
269 |
$new_contents = $self->parse_block($contents); |
|
270 |
} |
|
264 | 271 |
if (!defined($new_contents)) { |
265 | 272 |
$main::lxdebug->leave_sub(); |
266 | 273 |
return 0; |
SL/Template/Plugin/LxLatex.pm | ||
---|---|---|
1 |
package SL::Template::Plugin::LxLatex; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw( Template::Plugin ); |
|
5 |
|
|
6 |
my $cached_instance; |
|
7 |
|
|
8 |
sub new { |
|
9 |
my $class = shift; |
|
10 |
|
|
11 |
return $cached_instance ||= $class->SUPER::new(@_); |
|
12 |
} |
|
13 |
|
|
14 |
sub init { |
|
15 |
my $self = shift; |
|
16 |
|
|
17 |
$self->install_filter($self->{ _ARGS }->[0] || 'T8'); |
|
18 |
|
|
19 |
return $self; |
|
20 |
} |
|
21 |
|
|
22 |
sub filter { |
|
23 |
my ($self, $text, $args) = @_; |
|
24 |
return $::locale->quote_special_chars('Template/LaTeX', $text); |
|
25 |
} |
|
26 |
|
|
27 |
return 'SL::Template::Plugin::LxLatex'; |
SL/Template/Simple.pm | ||
---|---|---|
56 | 56 |
$self->{substitute_vars_re} = "$self->{tag_start_qm}(.+?)$self->{tag_end_qm}"; |
57 | 57 |
} |
58 | 58 |
|
59 |
sub set_use_template_toolkit { |
|
60 |
my $self = shift; |
|
61 |
my $value = shift; |
|
62 |
|
|
63 |
$self->{use_template_toolkit} = $value; |
|
64 |
} |
|
65 |
|
|
59 | 66 |
sub cleanup { |
60 | 67 |
my ($self) = @_; |
61 | 68 |
} |
Auch abrufbar als: Unified diff
Erste Version Template Toolkit Druck