/[d-i]/trunk/manual/scripts/doc-check
ViewVC logotype

Contents of /trunk/manual/scripts/doc-check

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4560 - (hide annotations) (download)
Sun Oct 5 13:56:45 2003 UTC (9 years, 7 months ago) by barbier
Original Path: trunk/doc/manual/doc-check
File size: 2098 byte(s)
Taken from boot-floppies, and slightly patched to work on DocBook XML
documents.
1 barbier 4560 #!/usr/bin/perl -w
2    
3     # This script checks if the translations of the documents are up to date.
4     # When called with "-d" option, it also prints what has changed in the
5     # original since last translation
6    
7     # SYNOPSIS:
8     # ./doc-check [-d] [-v] [-V] [lang]
9     #
10     # (uses $lang set below if lang is not given on commandline)
11    
12     use Getopt::Std;
13     use File::Find;
14     $opt_d = $opt_v = $opt_V = 0;
15     getopts('dvV');
16     # You may set this to your default language code
17     $lang = shift || "pl";
18    
19     sub checkdiff
20     {
21     my ($plfname, $enfname) = (@_);
22     my ($plrev, $enrev) = getrev($plfname, $enfname);
23     $plrev and $enrev or return;
24     if ( "$plrev" ne "$enrev" ) {
25     if ($opt_d) {
26     my $s = "cvs diff -b -u -r $plrev -r $enrev $enfname";
27     warn "running $s:\n" if ($opt_V);
28     system($s);
29     } else {
30     print "$enfname : $plrev -> $enrev\n";
31     }
32     }
33     }
34    
35     sub getrev
36     {
37     my ($plfname, $enfname) = (@_);
38     my ($plrev, $enrev) = (0, 0);
39    
40     warn "checking $plfname:\n" if $opt_v;
41     open FILE, $plfname or warn "$plfname: $!\n" and return;
42     while (<FILE>) {
43     if (/<!--\s*original version\D*([\d\.]+)\s*-->/) {
44     $plrev = $1;
45     last;
46     }
47     if (/<!--\s*original document: en\/\S+, revision ([\d\.]+)\s*-->/) {
48     $plrev = $1;
49     last;
50     }
51     }
52     warn "checking $enfname:\n" if $opt_v;
53     open FILE, $enfname or warn "$enfname: $!\n" and return;
54     while (<FILE>) {
55     if (/\$Id: [^\s]+ ([\d\.]+) .* Exp \$/) {
56     $enrev = $1;
57     last;
58     }
59     if (/\$Revision: ([\d\.]+) \$/) {
60     $enrev = $1;
61     last;
62     }
63     }
64     close FILE;
65     warn "failed to find revision for $plfname\n" unless $plrev;
66     warn "failed to find revision for $enfname\n" unless $enrev;
67     return ($plrev, $enrev);
68     }
69    
70     sub process
71     {
72     my $enfname = $File::Find::name;
73     return unless $enfname =~ m/\.xml$/;
74     my $plfname = $enfname;
75     $plfname =~ s,^en/,$lang/,;
76     checkdiff($plfname, $enfname);
77     }
78     File::Find::find({ wanted => \&process, no_chdir => 1 }, 'en');
79     checkdiff("install.$lang.xml", "install.en.xml");
80     #checkdiff("release-notes.$lang.sgml","release-notes.sgml");
81     #checkdiff("index.$lang.html.m4","index.en.html.m4");
82     #checkdiff("dselect-beginner.$lang.sgml","dselect-beginner.sgml");

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5