From owner-freebsd-doc Sun Dec 5 18:23:54 1999 Delivered-To: freebsd-doc@freebsd.org Received: from multi.al.rim.or.jp (multi.al.rim.or.jp [202.247.191.124]) by hub.freebsd.org (Postfix) with ESMTP id 2374E14EE0; Sun, 5 Dec 1999 18:23:15 -0800 (PST) (envelope-from kuriyama@sky.rim.or.jp) Received: from mail-relay.rim.or.jp by multi.al.rim.or.jp (8.8.8/3.7W/HMX-12) with ESMTP id UAA29212; Mon, 6 Dec 1999 20:23:43 +0900 (JST) Received: from rhea.sky.rim.or.jp (ppp528.kt.rim.or.jp [202.247.140.178]) by mail-relay.rim.or.jp (3.7W/HMX-12) id LAA25227; Mon, 6 Dec 1999 11:23:13 +0900 (JST) Received: from localhost.sky.rim.or.jp (localhost [127.0.0.1]) by rhea.sky.rim.or.jp (8.9.3/3.7W/rhea-1.2) with ESMTP id LAA10256; Mon, 6 Dec 1999 11:23:12 +0900 (JST) Date: Mon, 06 Dec 1999 11:23:11 +0900 Message-ID: <14411.7695.451533.69145D@localhost.sky.rim.or.jp> From: Jun Kuriyama To: wosch@FreeBSD.org To: Doc Team Subject: [www] Revision checking with English version in translations User-Agent: Wanderlust/1.0.3 (Notorious) SEMI/1.13.3 (Komaiko) FLIM/1.12.5 (Hirahata) MULE XEmacs/20.4 (Emerald) (i386--freebsd) MIME-Version: 1.0 (generated by SEMI 1.13.3 - "Komaiko") Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org I made patches to display "This page is not synchronized with the English version." message in the header of translated web pages. This make easy for web readers whether translated version contains latest information or not. Complete patches are stored in: http://www.FreeBSD.org/~kuriyama/www-revcheck.diff.gz Key components are here. I welcome any comment for this. Please review. 1. Add .sgml -> .revinc rule in web.mk. This tells how to make SGML include file which contains revision information. Index: en/web.mk =================================================================== RCS file: /home/ncvs/www/en/web.mk,v retrieving revision 1.26 diff -u -r1.26 web.mk --- web.mk 1999/11/29 15:11:56 1.26 +++ web.mk 1999/11/30 14:23:43 @@ -52,13 +52,26 @@ # Transformation rules ### +# file.sgml --> file.revinc +# +# Generate temporary file for translation revision checking +.SUFFIXES: .sgml .revinc +GENDOCS+= ${REVFILES} +.sgml.revinc: + if [ -f ${BUILDTOP}/en/${DIR_IN_LOCAL}/${.IMPSRC} ]; then \ + ${BUILDTOP}/ja/revcheck ${BUILDTOP} ${DIR_IN_LOCAL} ${.IMPSRC} > ${.TARGET}; \ + else \ + touch ${.TARGET}; \ + fi + +### # file.sgml --> file.html # # Runs file.sgml through spam to validate and expand some entity # references are expanded. file.html is added to the list of # things to install. -.SUFFIXES: .sgml .html +.SUFFIXES: .html SGMLNORM= sgmlnorm PREFIX?= /usr/local CATALOG?= ${PREFIX}/share/sgml/html/catalog 2. Add ja/revcheck script. This script makes revision information from English SGML file and localized one. Index: ja/revcheck =================================================================== RCS file: revcheck diff -N revcheck --- /dev/null Mon Dec 6 03:22:35 1999 +++ revcheck Mon Dec 6 10:47:29 1999 @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w +# +# The FreeBSD Japanese Documentation Project +# +# usage: revcheck +# +# $FreeBSD$ + +my $buildtop = $ARGV[0]; +my $reldir = $ARGV[1]; +my $name_ja = $ARGV[2]; +my $dir_en = $buildtop . "/en/" . $reldir; +my $name_en = $dir_en . "/" . $name_ja; +my $rev_en; +my $rev_ja; +my $basename = $name_ja; + +$basename =~ s/\.sgml//; + +### File exist? +die "Cannot read local file: $!\n" + unless -r $name_ja; +die "Cannot read English file: $!\n" + unless -r $name_en; + +### Open English file. +open EN, $name_en or die "Cannot open English file: $!\n"; +while () { + if (/\$FreeBSD: .* (.*) .* .* .* .* \$/) { + $rev_en = $1; + last; + } +} +close EN; + +### Open Localized file. +open JA, $name_ja or die "Cannot open localized file: $!\n"; +while () { + if (/Original [Rr]evision:[ \t]*([0-9.]+)/) { + $rev_ja = $1; + last; + } +} +close JA; + +#print ".if \${REV_NAME} == $name_ja\n"; +# print ".if \${.IMPSRC} == $name_ja\n"; +# print "LATEST_EN_REV= $rev_en\n"; +# print "CURRENT_BASE_REV= $rev_ja\n"; +# print ".endif\n"; +print "\n"; +print "\n"; +print "\n"; +print "\n"; +print "\n"; +print "\n"; +printf "\n", ($rev_ja eq $rev_en) ? "IGNORE" : "INCLUDE"; 3. Add *.revinc files into GENDOCS in localized Makefile. This will generate *.revinc files from each *.sgml files. Index: ja/Makefile =================================================================== RCS file: /home/ncvs/www/ja/Makefile,v retrieving revision 1.36 diff -u -r1.36 Makefile --- Makefile 1999/11/07 11:33:12 1.36 +++ Makefile 1999/11/25 14:16:24 @@ -66,6 +66,11 @@ SGMLOPTS= -links -hdr ${.CURDIR}/doc.hdr -ftr ${.CURDIR}/doc.ftr -e EUC-JP WEBDIR= data/ja + +### Revision checking +REVFILES= ${DOCS:M*.sgml:S/.sgml$/.revinc/g} +BUILDTOP= .. +DIR_IN_LOCAL= . .include "../web.mk" 4. Add %rev.diff entity into localized includes.sgml. Of course, below patch is translated into English not to confuse non-Japanese mail reader. Index: ja/includes.sgml =================================================================== RCS file: /home/ncvs/www/ja/includes.sgml,v retrieving revision 1.18 diff -u -r1.18 includes.sgml --- includes.sgml 1999/11/28 14:29:35 1.18 +++ includes.sgml 1999/11/30 14:25:22 @@ -33,12 +33,26 @@ FreeBSD Home Page'> + + + + +(Traslation Notes: Latest English version has + +differences with this file.) +

'> +]]> + + &title;Menu +&rev.msg;

&title;


5. At last, add statement to include *.revinc for each *.sgml files. For example, add one line like this. Index: ja/applications.sgml =================================================================== RCS file: /home/ncvs/www/ja/applications.sgml,v retrieving revision 1.10 diff -u -r1.10 applications.sgml --- applications.sgml 1999/09/07 15:15:44 1.10 +++ applications.sgml 1999/11/25 13:08:33 @@ -1,6 +1,7 @@ + %rev.incl; %includes; ]> Jun Kuriyama // kuriyama@sky.rim.or.jp // kuriyama@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message