File: parse_tex.pl

package info (click to toggle)
sympa 4.1.5-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 11,504 kB
  • ctags: 2,195
  • sloc: perl: 18,884; sh: 4,032; makefile: 1,173; ansic: 226; php: 105; lisp: 32
file content (75 lines) | stat: -rw-r--r-- 2,112 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# parse_tex.pl - This script parses parts of the sympa.tex.tpl
# RCS Identication ; $Revision: 1.9 $ ; $Date: 2003/12/22 13:22:18 $ 
#
# Sympa - SYsteme de Multi-Postage Automatique
# Copyright (c) 1997, 1998, 1999, 2000, 2001 Comite Reseau des Universites
# Copyright (c) 1997,1998, 1999 Institut Pasteur & Christophe Wolfhugel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

use lib "../src/";
use lib "../wwsympa/";
use Log;
use Conf;
use POSIX;
require "parser.pl";

my $in_file = $ARGV[0];
my $out_file = $ARGV[1];

$ENV{'LC_ALL'} = 'C';

my $date = (stat($in_file))[9];

open VERSION, '../.version';
my $version = <VERSION>;
chomp $version;
close VERSION;

## Init struct
my %data = ('escaped_start' => '[STARTPARSE]',
	    'escaped_stop' => '[STOPPARSE]',
	    'date' => &POSIX::strftime("%d %B %Y", localtime((stat($in_file))[9])),
	    'version' => $version
	    );

## All DIR variables
foreach my $k (keys %ENV) {
#    if ($k =~ /DIR$/) {
	$data{$k} = $ENV{$k};
#    }
}

## scenari
foreach my $file (<../src/etc/scenari/*.*>) {
    $file =~ /\/(\w+)\.(\w+)$/;
    my ($action, $name) = ($1, $2);
    my $title;
    open SCENARIO, $file;
    while (<SCENARIO>) {
	if (/^title.us\s*(.*)$/) {
	    $title = $1; last;
	}
    }
    close SCENARIO;
    $name =~ s/\_/\\\_/g;
    push @{$data{'scenari'}{$action}}, {'name' => $name,'title' => $title};
}

open OUT, ">$out_file" || die;
&parser::parse_tpl(\%data, $in_file, \*OUT);
close OUT;

exit 0;