Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jun 2003 20:59:38 +0200 (CEST)
From:      Lukas Ertl <l.ertl@univie.ac.at>
To:        FreeBSD-gnats-submit@FreeBSD.org, freebsd-doc@FreeBSD.org
Cc:        Lukas Ertl <le@univie.ac.at>
Subject:   Re: docs/53315: [PATCH] remove extraneous whitespace at the end of lines in articles
Message-ID:  <20030616205705.H550@korben.in.tern>
In-Reply-To: <200306141250.h5ECoBGZ043143@freefall.freebsd.org>
References:  <200306141250.h5ECoBGZ043143@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 14 Jun 2003 FreeBSD-gnats-submit@FreeBSD.org wrote:

> >Category:       docs
> >Responsible:    freebsd-doc
> >Synopsis:       [PATCH] remove extraneous whitespace at the end of lines=
 in articles
> >Arrival-Date:   Sat Jun 14 05:50:11 PDT 2003

Ok, I see that a 200k+-sized patch isn't really appreciated. :-)

The following Perl script does the same job. Call it "cleanspaces" or
whatever and run it like "cleanspaces *.sgml".

---8<---
#!/usr/bin/perl -w

use strict;

for my $file (@ARGV) {
    my $dont_touch =3D 0;
    my $bak =3D "$file.bak";
    open IN, "<$file" or die $!;
    open OUT, ">$bak" or die $!;
    while (<IN>) {
        if (m!<programlisting>|<pre>|<\!--|<screen>|<literallayout[^>]+>!) =
{
            $dont_touch =3D 1;
        }
        if (m!</programlisting>|</pre>|-->|</screen>|</literallayout>!) {
            $dont_touch =3D 0;
        }
        s/\s+$/\n/ unless $dont_touch;
        print OUT $_;
    }
    close IN;
    close OUT;
    rename ($bak, $file) or die $!;
}
---8<---

regards,
le

--=20
Lukas Ertl                             eMail: l.ertl@univie.ac.at
UNIX-Systemadministrator               Tel.:  (+43 1) 4277-14073
Zentraler Informatikdienst (ZID)       Fax.:  (+43 1) 4277-9140
der Universit=E4t Wien                   http://mailbox.univie.ac.at/~le/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030616205705.H550>