From owner-freebsd-doc@FreeBSD.ORG Tue Dec 23 06:55:00 2003 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8ABAF16A4CE for ; Tue, 23 Dec 2003 06:55:00 -0800 (PST) Received: from parati.mdbrasil.com.br (parati.mdbrasil.com.br [200.210.70.4]) by mx1.FreeBSD.org (Postfix) with SMTP id 2B89A43D39 for ; Tue, 23 Dec 2003 06:54:58 -0800 (PST) (envelope-from eksffa@freebsdbrasil.com.br) Received: (qmail 73753 invoked by uid 85); 23 Dec 2003 14:56:10 -0000 Received: from eksffa@freebsdbrasil.com.br by parati.mdbrasil.com.br by uid 82 with qmail-scanner-1.20rc1 (uvscan: v4.1.60/v4288. Clear:RC:1:. Processed in 0.166432 secs); 23 Dec 2003 14:56:10 -0000 Received: from unknown (HELO freebsdbrasil.com.br) (200.97.24.184) by parati.mdbrasil.com.br with SMTP; 23 Dec 2003 12:56:09 -0200 Message-ID: <3FE8573F.10706@freebsdbrasil.com.br> Date: Tue, 23 Dec 2003 12:54:55 -0200 From: Patrick Tracanelli Organization: FreeBSD Brasil LTDA User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030524 X-Accept-Language: en-us, en MIME-Version: 1.0 To: doc@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: Diego Linke - GAMK Subject: FDP rules script X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2003 14:55:00 -0000 Hello DOCers, Mario Sergio (lioux@freebsd.org) uses to maintain a grep script that verifies some FDP rules on the SGML files, which is used a lot of times by the pt_BR doc. proj. But now, after some little talk among some of us, Diego Linke has written a perl script that just do not checks for FDP rules, but also corrects them. It is still in BETA state. I know most of the rules are not "fatal" but at least they save some disk space on making it. If there is a chance it is any usefull for the main Doc. Proj, the small script follows in this message's body. Everything it does, is commented. Best Regards -- Atenciosamente, Patrick Tracanelli FreeBSD Brasil LTDA. The FreeBSD pt_BR Documentation Project http://www.freebsdbrasil.com.br patrick @ freebsdbrasil.com.br "Long live Hanin Elias, Kim Deal!" ------------------------------------------------------------- #!/usr/bin/env perl # # This script "fixes" some FDP broken rules such as: # 1) Removes space(s) after tag # 2) Removes space(s) before tag # 3) Removes all spaces on clear lines and leaves # only new line specifier -- the \n # 4) Removes clear spaces right after the end of the lines # 5) Substitutes 8 spaces by a \t (a TAB) # 6) Substitutes 1 space after a phrase separator (.?!) by 2 spaces # 7) If there are 2 spaces between two words, it removes one of them # # This scripts "tells" the following good behaviour breakage: # 1) Generates a WARNING everytime each line has more than 70 collumns # # Written by Diego Linke # The FreeBSD pt_BR Documentation Project # if (!$ARGV[0]) { print STDERR "This scripts requires one argument (sintax: fdp.pl [file_name]).\n"; exit(1); } open(FILE,$ARGV[0]) or die "Could not open $ARGV[0].\n"; $cont = 0; $lc = 0; while ($linha = ) { $lc++; $linha =~ s/(\n|\r)//g; $linha_old = $linha; $linha =~ s/\ +//g; $linha =~ s/\ +<\/para>/<\/para>/g; $linha =~ s/^\ +$//g; $linha =~ s/\ +$//g; $linha =~ s/\ {8}/\t/g; $linha =~ s/(\.|\?|\!) (\w)/\1 \2/g; $linha =~ s/(\w) (\w|&|%)/\1 \2/g; print $linha . "\n"; $linha_cont = $linha; $linha_cont =~ s/\t/ /g; if (length($linha_cont) > 70) { print STDERR "WARNING: Line $lc is over 70 collumns. It actually has " . length($linha_cont) . " collumns\n"; } $cont++ if ($linha ne $linha_old); } print STDERR "\nfdp.pl: $cont line(s) were modified on $ARGV[0]\n"; close(FILE);