[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][TOP]
Re: GGAD startup.sgml
From: Masato SHIBATA <xten@xxxxxxxxxxxxxxxx>
Subject: Re: GGAD startup.sgml
Date: 03 Dec 2000 03:30:34 +0900
Message-ID: <20001202182946.499B631BD8@xxxxxxxxxxxxxxxxxxxx>
こんにちは、相花です。
sgml のコメントについて。
> > > ところで、今のところ原文をコメントアウトして残しているのですが、
> > > これって消した方が良いでしょうか?
> >
> > みんな消してますが、査読の時は便利かもしれませんね。
> > commit前に消せば問題ないのではないでしょうか?
> 了解です。
自分も同じ経験があります。
査読用には "コメント有り" 、
コンパイル用(gtkdoc-mkhtml, db2htmlなんかの食わせてhtmlで吐かせる) には "コメント無し"
と二つ用意していました。
特に、"doc/tmpl/*.sgml" なんかは "コメント有り"だと、
自分の jade-1.2.1 だとエラーがたくさん出ました。
それで、翻訳する時は原文をコメント有りで作成し、コンパイルの時にコメントを外すスクリプト
でコメントを外してます。
参考に(コテコテの)スクリプト添付します。
スクリプト内の LINE 19 にあるディレクトリを、
コメント無しを格納するディレクトリに適当に書き直すか、
my $DIST_DIR = "...."
もしくは、
オプション "-d コメント無しを格納するディレクトリ" を指定して下さい。
% excomment.pl [-d コメント無しを格納するDIR] コメント有りが格納されているDIR
それでは。
---
(相花)
#!/usr/bin/perl
#!/usr/bin/perl -w
#-*- Perl -*-
use strict;
use File::Basename;
#===================================================
# Filename: excomment.pl
# Utility to comment out from specified sgml file
# usage : excomment.pl [Options] SOURCE_DIR
#
# Ver1.00 : T.Aihana 2000/11/08 First Release.
my $VerNo = "1.00";
#===================================================
# ---- GET ENVIRONMENT VALUES -----
use Env ( "HOME","USER","PWD","CVSROOT","CVS_RSH" );
# ---- GLOBAL VALUES ----
my $SRC_DIR = undef;
my $DIST_DIR = "/home/aihana/mygnome/GNOME/translations/glib-reference-SNAP001101/tmpl/";
# ---- LOCALE VALUES ----
my ($i, $fname, $pname, $line, $line0, );
DispUsage() if( @ARGV < 0 );
$i = 0;
while( $ARGV[$i] ){
DispUsage() if( $ARGV[$i] eq "-h" || $ARGV[$i] eq "--help" );
if( $ARGV[$i] eq "-d" || $ARGV[$i] eq "--dist" ){
$DIST_DIR = $ARGV[$i+1] if( defined $ARGV[$i+1] && -e $ARGV[$i+1] );
$i++;
}else{
$SRC_DIR = $ARGV[$i] if( defined $ARGV[$i] && -e $ARGV[$i] );
}
$i++;
}
print "SRC_DIR = $SRC_DIR\n";
print "DIST_DIR = $DIST_DIR\n\n";
while( $pname = <$SRC_DIR/*.sgml> ){
$fname = basename( $pname, ".*" );
open( SRCFILE, "<$pname" ) || die "\nERROR(excomment) Could not open as READ : $fname\n";
open( DISTFILE,">$DIST_DIR/$fname") || die "\nERROR(excomment) Could not open as WRITE: $DIST_DIR/$fname\n";
print "processing : \"$fname\" ...\n";
while( defined ($line = <SRCFILE>) ){
if( $line =~ /^<!--.*$/ && !($line =~ /^<!--\s\#+.*$/) ){
next if( $line =~ /^<!--.*-->/ );
while( $line0 = <SRCFILE> ){
last if( $line0 =~ /^-->$/ );
}
}else{
print DISTFILE $line;
}
}
close( SRCFILE );
close( DISTFILE );
}
sub DispUsage{
print "-Help : Ver$VerNo\n";
print " Description: Utility to comment out from specified sgml file\n";
print " Usage: excomment.pl [OPTIONS...] SOURCE_DIRECTORY\n";
print " -h, --help : display this message.\n";
print " -d, --dist DISTRIBUTION_DIRECTORY : the location where copy after processed.\n";
print "\n";
exit( 1 );
}