source: subversion/applications/rendering/tilesAtHome/attribution.pl @ 6008

Last change on this file since 6008 was 4639, checked in by frederik, 13 years ago

new attribution postprocessor replaces content of "user" attributes by something placed in attribution.txt

File size: 676 bytes
Line 
1#!/usr/bin/perl
2
3# simple script that changes attribution by transformin the "user" attributes
4# found in the input file.
5#
6# user=foo becomes user=© foo
7# unless "foo" is found in attribution.txt, in which case anything entered there
8# will be used.
9
10use strict;
11my %mapping;
12
13open(ATT, "attribution.txt") or die;
14while(<ATT>)
15{
16    next if (/^#/);
17    chomp;
18    my ($old, $new) = split(/=/);
19    $mapping{$old} = ($new eq "") ? " " : $new;
20}
21close(ATT);
22
23while(<>)
24{
25    chomp;
26    while(/^(.*?)\s+user="([^"]+)"(.*)/g)
27    {
28        print $1;
29        printf ' user="%s"', defined($mapping{$2}) ? $mapping{$2} : "&#169; $2";
30        $_ = $3;
31    }
32    print "$_\n";
33}
Note: See TracBrowser for help on using the repository browser.