diff options
author | Peter Karlsson <peterk> | 2001-05-02 07:36:30 +0000 |
---|---|---|
committer | Peter Karlsson <peterk> | 2001-05-02 07:36:30 +0000 |
commit | ce9e7dc372a69ed1f07c901cfd88b4c4c13ae7c3 (patch) | |
tree | bbd95aefea98f9213c5279ca0f6a6d53d70c8bbd /copypage.pl | |
parent | d8a796c61087a979e0600ce688136bff84727c5d (diff) |
Use .title file if such exists (news)
CVS version numbers
copypage.pl: 1.11 -> 1.12
Diffstat (limited to 'copypage.pl')
-rwxr-xr-x | copypage.pl | 35 |
1 files changed, 34 insertions, 1 deletions
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 (<TTL>) + { + $pagetitle = $_, last + if /^<define-tag pagetitle>/; + } + + 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 && /^<define-tag pagetitle>/) + { + print DST $pagetitle; + } + else + { + print DST $_; + } $isdefinetag = 0 if m'</define-tag>'; $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; } |