From ce9e7dc372a69ed1f07c901cfd88b4c4c13ae7c3 Mon Sep 17 00:00:00 2001 From: Peter Karlsson Date: Wed, 2 May 2001 07:36:30 +0000 Subject: Use .title file if such exists (news) CVS version numbers copypage.pl: 1.11 -> 1.12 --- copypage.pl | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'copypage.pl') diff --git a/copypage.pl b/copypage.pl index 33d76ce2a20..53d1568fb1c 100755 --- a/copypage.pl +++ b/copypage.pl @@ -78,6 +78,9 @@ sub copy my $srcmake = $srcdir . "Makefile"; # Name of source Makefile my $dstmake = $dstdir . "Makefile"; # Name of destination Makefile + my $dsttitle = $dstfile; + $dsttitle =~ s/\.wml$/.title/; # Name of possible title translation + # Sanity checks die "Directory $srcdir does not exist\n" unless -d $srcdir; die "File $srcfile does not exist\n" unless -e $srcfile; @@ -94,6 +97,27 @@ sub copy system "cp $srcmake $dstmake"; } + # Check if title translation exists, if so - load it + my $pagetitle; + if (-e $dsttitle) + { + open TTL, $dsttitle + or die "Could not read $dsttitle ($!)\n"; + + # Scan for title; + while () + { + $pagetitle = $_, last + if /^/; + } + + close TTL; + } + else + { + undef $dsttitle; + } + # Open the files open CVS, $cvsfile or die "Could not read $cvsfile ($!)\n"; @@ -138,7 +162,14 @@ sub copy print DST qq'#use wml::debian::translation-check translation="$revision"\n'; $insertedrevision = 1; } - print DST $_; + if (defined $pagetitle && /^/) + { + print DST $pagetitle; + } + else + { + print DST $_; + } $isdefinetag = 0 if m''; $ignorews = 0 if /^#/; @@ -154,5 +185,7 @@ sub copy # We're done print "Copied $page, remember to edit $dstfile\n"; + print "and to remove $dsttitle when finished\n" + if defined $dsttitle; } -- cgit v1.2.3