develooper Front page | perl.perl5.porters | Postings from May 2012

Re: [perl #103202] roffitall's TOC generation broken

Thread Previous | Thread Next
From:
Russ Allbery
Date:
May 26, 2012 13:40
Subject:
Re: [perl #103202] roffitall's TOC generation broken
Message ID:
87aa0u7k1v.fsf@windlord.stanford.edu
Nicholas Clark <nick@ccl4.org> writes:

>> I did this:
>> 
>> $ git diff
>> diff --git a/cpan/podlators/lib/Pod/Man.pm b/cpan/podlators/lib/Pod/Man.pm
>> index 96f3fcc..4b19cb2 100644
>> --- a/cpan/podlators/lib/Pod/Man.pm
>> +++ b/cpan/podlators/lib/Pod/Man.pm
>> @@ -1397,7 +1397,6 @@ sub preamble_template {
>>  .    tm Index:\\$1\t\\n%\t"\\$2"
>>  ..
>>  .    nr % 0
>> -.    rr F
>>  .\}
>>  .el \{\
>>  .    de IX
>> diff --git a/pod/rofftoc b/pod/rofftoc
>> old mode 100644
>> new mode 100755
>> 
>> and everything seems to work.
>> 
>> (didn't spot any warnings while running make install, cursory test of 1
>> man page still looks good, and *now* PerlTOC.ps has the right contents)

> But the page numbers in the TOC reset for every man page.
> Which I didn't notice first time.

I finally got a chance to look at this in more detail, in combination with
another bug report about suppressing warnings from groff about undefined
registers.  I decided to (somewhat arbitrarily) decide on a value of "2"
for the F register to mean to do indexing and to not reset the page
number.  The resulting preamble section below appears to now work
properly:

.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
.    if \nF \{
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF

(The rF logic is to suppress groff warnings.)

This will be in the next podlators release.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About