-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakemap.pl
More file actions
36 lines (27 loc) · 790 Bytes
/
makemap.pl
File metadata and controls
36 lines (27 loc) · 790 Bytes
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
#!/usr/bin/env perl
# script to insert files into a source file
$source = 'maptest.html';
$output = 'maplive.html';
open(SOURCE, '<', $source) or die $!;
open(OUTPUT, '>', $output) or die $!;
print "Reading $source -> $output\n";
while (<SOURCE>)
{
print OUTPUT $_;
if (/\{\{\s*include:\s*(\S+)\s*(?:filter:\s*(\S+)\s*)?\}\}/)
{
my $filename = $1;
my $filter = $2;
print "Inserting $filename" . ($filter ? " with filter $filter" : '') . "\n";
open(INSERT, '<', $filename) or die $!;
while (<INSERT>)
{
next if ($filter && !/$filter/);
print OUTPUT $_;
}
close(INSERT);
}
}
close(OUTPUT) || die $!;
close(SOURCE);
print "$output complete\n";