source: subversion/applications/rendering/tahNG/development/attribution.pl @ 29350

Last change on this file since 29350 was 7359, checked in by deelkar, 12 years ago

add preprocessors from tah

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.