[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#167379: dpkg: toward better info dir formatting



Package: dpkg
Version: 1.10.9
Severity: normal
Tag: patch

Something is causing very long titles in the info pages, and this is
leading to stuff like this in the info dir file:

* Date input formats: (coreutils)Date input formats.
* autoconf: (autoconf)autoconf Invocation.           How to create
                                                     configuration scripts

That shove the descriptions over to a 20 or so character wide column.
The overall result makes it a lot harder to read the descriptions than I
recall it being before:

* Bfd: (bfd).                                        The Binary File
                                                     Descriptor library.
* Binutils: (binutils).                              The GNU binary utilities.
* ar: (binutils)ar.                                  Create, modify, and
                                                     extract from archives
* gprof: (gprof).                                    Profiling your program's
                                                     execution

* XaoS: (xaos).                                      The fast realtime
                                                     interactive fractal
                                                     zoomer
* xzgv: (xzgv).                                      A picture viewer for X,
                                                     with a thumbnail-based
                                                     file selector.
* Festival: (festival).                              The `Festival' Speech
                                                     Synthesis System a
                                                     general text to speech
                                                     system for making your
                                                     computer talk and
                                                     developing new synthesis
                                                     techniques.

The main cause of the problem seems to be a few packages (coreutils,
autoconf), that choose to use one info file for a number of topics, and
register all of those topic in the top-level info dir. That means that
they have to use rather long info references, like "(coreutils)Date
input formats". The result is a long line which given the current
way install-info lays out the dir file, shoves every description into a
narrow column, with much word-wrapping.

Since I can see no way for the coreutils package to cut this line down,
really, I began to think about reformatting the info dir instead. I have
a patch that makes the descriptions be laid out in a way reminiscent
of .TP lines on man pages, letting descriptions always start in column 
40 (not ideal, but I haven't tried to make it adaptively pick the best
column yet). The result looks pretty good most of the time:

* Bfd: (bfd).                           The Binary File Descriptor library.
* Binutils: (binutils).                 The GNU binary utilities.
* ar: (binutils)ar.                     Create, modify, and extract from
                                        archives

Looks reasonable for items with longer descriptions:

* XaoS: (xaos).                         The fast realtime interactive fractal
                                        zoomer
* xzgv: (xzgv).                         a picture viewer for X, with a
                                        thumbnail-based file selector.
* Festival: (festival).                 The `Festival' Speech Synthesis System
                                        a general text to speech system for
                                        making your computer talk and
                                        developing new synthesis techniques.

And is still readable, though not pretty, for items with oversize
title + references:

* GNU Utilities: (coreutils).           GNU Utilities.
* Common options: (coreutils)Common options.
                                        Common options.
* File permissions: (coreutils)File permissions.
                                        Access modes.
* Date input formats: (coreutils)Date input formats.

With the patch install-info converts the dir file over to the new layout
without problems. I'm only changing whitespace, so none of the dir parsing
seems to break.

Here's the patch:

--- /usr/sbin/install-info	2002-09-15 14:36:46.000000000 -0400
+++ install-info	2002-11-01 14:24:28.000000000 -0500
@@ -408,12 +408,20 @@
 }
 @work = @work[0..$j];
 
+my $descalign=40;
+
 @newwork = ();
 foreach ( @work ) {
 	if ( m/^(\* *[^:]+: *\(\w[^\)]*\)[^.]*\.)[ \t]*(.*)/ ||
 		m/^([ \t]+)(.*)/ ) {
-		$_ = $1 . ( " " x ( $length - length($1) + 1 ) ) . $2;
-		push @newwork, split( "\n", wrap('', " " x ( $length + 1 ), $_ ) );
+		if (length $1 >= $descalign) {
+			push @newwork, $1;
+			$_=(" " x $descalign) . $2;
+		}
+		else {
+			$_ = $1 . (" " x ($descalign - length $1)) . $2;
+		}
+		push @newwork, split( "\n", wrap('', " " x $descalign, $_ ) );
 	} else {
 		push @newwork, $_;
 	}

The obvious enhancement is to make it calculate $descalign better.
The current value of 40 works pretty well for what we have now, and
it should probably not exceed 40 (or we'd go back to the current situation
of not having enough space for the descriptions). It could easily be less
than 40 for some info dirs though.

-- 
see shy jo

Attachment: pgpj6SP19aRbZ.pgp
Description: PGP signature


Reply to: