line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# format::latex Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Format::Latex; |
7
|
1
|
|
|
1
|
|
539
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
37
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Shell::Command Metabrik::System::Package Metabrik::Client::Www); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
435
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
datadir => [ qw(datadir) ], |
20
|
|
|
|
|
|
|
style => [ qw(file) ], |
21
|
|
|
|
|
|
|
capture_mode => [ qw(0|1) ], |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
attributes_default => { |
24
|
|
|
|
|
|
|
style => 'llncs.cls', |
25
|
|
|
|
|
|
|
capture_mode => 0, |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
commands => { |
28
|
|
|
|
|
|
|
install => [ ], # Inherited |
29
|
|
|
|
|
|
|
update => [ ], |
30
|
|
|
|
|
|
|
make_dvi => [ qw(input style|OPTIONAL) ], |
31
|
|
|
|
|
|
|
make_pdf => [ qw(input style|OPTIONAL) ], |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
require_modules => { |
34
|
|
|
|
|
|
|
'Metabrik::File::Compress' => [ ], |
35
|
|
|
|
|
|
|
'Metabrik::System::File' => [ ], |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
require_binaries => { |
38
|
|
|
|
|
|
|
latex => [ ], |
39
|
|
|
|
|
|
|
pdflatex => [ ], |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
need_packages => { |
42
|
|
|
|
|
|
|
ubuntu => [ qw(texlive texlive-latex-extra texlive-lang-french) ], # Sorry, the author is French |
43
|
|
|
|
|
|
|
debian => [ qw(texlive texlive-latex-extra texlive-lang-french) ], # Sorry, the author is French |
44
|
|
|
|
|
|
|
kali => [ qw(texlive texlive-latex-extra texlive-lang-french) ], # Sorry, the author is French |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub update { |
50
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $datadir = $self->datadir; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my @urls = ( |
55
|
|
|
|
|
|
|
'ftp://ftp.springer.de/pub/tex/latex/llncs/latex2e/llncs.cls', |
56
|
|
|
|
|
|
|
'https://www.usenix.org/sites/default/files/usenix.sty_.txt', |
57
|
|
|
|
|
|
|
'https://www.usenix.org/sites/default/files/template.la_.txt', |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
my $r = $self->mirror(\@urls) or return; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my @final = (); |
63
|
0
|
0
|
|
|
|
|
my $fc = Metabrik::File::Compress->new_from_brik_init($self) or return; |
64
|
0
|
0
|
|
|
|
|
my $sf = Metabrik::System::File->new_from_brik_init($self) or return; |
65
|
0
|
|
|
|
|
|
for (@$r) { |
66
|
0
|
0
|
|
|
|
|
if (/usenix.sty_.txt$/) { |
|
|
0
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
|
my $files = $fc->uncompress($_) or next; |
68
|
0
|
0
|
|
|
|
|
next if (@$files == 0); |
69
|
0
|
|
|
|
|
|
$_ = $files->[0]; |
70
|
0
|
0
|
|
|
|
|
my $basedir = $sf->basedir($_) or next; |
71
|
0
|
0
|
|
|
|
|
$sf->copy($_, $basedir.'/'.'usenix.sty') or next; |
72
|
0
|
|
|
|
|
|
$_ = $basedir.'/'.'usenix.sty'; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
elsif (/template.la_.txt$/) { |
75
|
0
|
0
|
|
|
|
|
my $files = $fc->uncompress($_) or next; |
76
|
0
|
0
|
|
|
|
|
next if (@$files == 0); |
77
|
0
|
|
|
|
|
|
$_ = $files->[0]; |
78
|
0
|
0
|
|
|
|
|
my $basedir = $sf->basedir($_) or next; |
79
|
0
|
0
|
|
|
|
|
$sf->copy($_, $basedir.'/'.'usenix-template.tex') or next; |
80
|
0
|
|
|
|
|
|
$_ = $basedir.'/'.'usenix-template.tex'; |
81
|
|
|
|
|
|
|
} |
82
|
0
|
|
|
|
|
|
push @final, $_; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return \@final; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub make_dvi { |
89
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
90
|
0
|
|
|
|
|
|
my ($input, $style) = @_; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
0
|
|
|
|
$style ||= $self->style; |
93
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('make_dvi', $input) or return; |
94
|
0
|
0
|
|
|
|
|
$self->brik_help_run_file_not_found('make_dvi', $input) or return; |
95
|
0
|
0
|
|
|
|
|
$self->brik_help_run_file_not_found('make_dvi', $style) or return; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $cmd = "latex \"$input\""; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return $self->execute($cmd); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub make_pdf { |
103
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
104
|
0
|
|
|
|
|
|
my ($input, $style) = @_; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $datadir = $self->datadir; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
0
|
|
|
|
$style ||= $datadir.'/'.$self->style; |
109
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('make_pdf', $input) or return; |
110
|
0
|
0
|
|
|
|
|
$self->brik_help_run_file_not_found('make_pdf', $input) or return; |
111
|
0
|
0
|
|
|
|
|
$self->brik_help_run_file_not_found('make_pdf', $style) or return; |
112
|
|
|
|
|
|
|
|
113
|
0
|
0
|
|
|
|
|
my $sf = Metabrik::System::File->new_from_brik_init($self) or return; |
114
|
0
|
0
|
|
|
|
|
$sf->copy($style, ".") or return; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my $cmd = "pdflatex \"$input\""; |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
return $self->execute($cmd); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |