Re: Bogus index in man-pages book from other projects

G. Branden Robinson
2024-03-12T20:49:32Z

[-- Attachment #1: Type: text/plain, Size: 4867 bytes --]

[looping in groff list]

Hi Deri,

Good to hear from you!

At 2024-03-12T18:25:36+0000, Deri wrote:
> On Tuesday, 12 March 2024 15:15:18 GMT G. Branden Robinson wrote:
> > [looping in groff list]
> >
> > Hi Alex,
> >
> > I'm attaching another couple of examples to illustrate this.
> >
>
> Unfortunately, these are not examples of best practice for creating
> reference bookmarks.

They certainly aren't! I didn't intend them as a demonstration of best
practice; they were files from my "experiments" directory, where I have
hundreds...uh...1,834 files exercising various aspects of groff.

My intent was to share a simple and straightforward demonstration of the
point I raised, about 8-bit characters being smugglable from *roff input
to device-independent output using the `pdfbookmark` macro as the
vehicle.

> The problem is the bookmarks are just numbered and if you have a
> large document it is easier to give the bookmark a mnemonic instead.
>
> ==========================================================================
>
> .\" groff -Kutf8 -Tpdf
> .de NmSection
> . sp 1i
> . ft B
> . ds pdfsecnm \\$1
> . shift
> . pdfbookmark -T \\*[pdfsecnm] 1 "\\$*"
> . nop \\$*
> . ft
> . sp
> ..
> .NmSection Intro "\%A naïve attempt at bookmarking"
> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
> accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab
> illo inventore veritatis et quasi architecto beatae vitae dicta sunt,
> explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur
> aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione
> voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum,
> quia dolor sit amet consectetur adipiscivelit, sed quia non-numquam eius
> modi tempora incidunt, ut labore et dolore magnam aliquam quaerat
> voluptatem.
> .bp
> .NmSection Another "Another section"
> Return to
> .pdfhref L -D Intro -- the first section
> or
> .pdfhref L -A . -D Another -- the last one

I'm pleased to report that this example also works fine to demonstrate
PDF bookmarking functionality in groff Git HEAD, despite a recent change
I've made to pdf.tmac.

What change and why?

Let me share a further development of the foregoing example.

.\" groff -Kutf8 -Tpdf
.de NmSection
. sp 1i
. ft B
. ds pdfsecnm \\$1
. shift
. pdfbookmark -T \\*[pdfsecnm] 1 "\\$*"
. nop \\$*
. ft
. sp
..
.NmSection \%Wacky\-Intro\:duction "A naïve attempt at bookmarking"
Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab
illo inventore veritatis et quasi architecto beatae vitae dicta sunt,
explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur
aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione
voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum,
quia dolor sit amet consectetur adipiscivelit, sed quia non-numquam eius
modi tempora incidunt, ut labore et dolore magnam aliquam quaerat
voluptatem.
.bp
.NmSection Another "Another section"
Return to
.pdfhref L -D \%Wacky\-Intro\:duction -- the first section
or
.pdfhref L -A . -D Another -- the last one

In groff 1.22.4, formatting the foregoing with "groff -Tpdf" yields the
following.

$ /usr/bin/groff -Tpdf /tmp/branden/naive-gbr2-latin1.groff >/dev/null
troff: /tmp/branden/naive-gbr2-latin1.groff:12: '\%' is not allowed in a name
troff: /tmp/branden/naive-gbr2-latin1.groff:12: bad string definition
troff: /tmp/branden/naive-gbr2-latin1.groff:12: can't translate character code 239 to special character ':i' in transparent throughput

groff 1.23.0 says similar:

$ GROFF_ENABLE_TRANSPARENCY_WARNINGS=1 ~/groff-stable/bin/groff -Tpdf /tmp/branden/naive-gbr2-latin1.groff >/dev/null
troff:/tmp/branden/naive-gbr2-latin1.groff:12: error: an escaped '%' is not allowed in an identifier
troff:/tmp/branden/naive-gbr2-latin1.groff:12: error: bad string definition
troff:/tmp/branden/naive-gbr2-latin1.groff:12: error: can't translate character code 239 to special character ':i' in transparent throughput

But now in groff Git HEAD:

$ GROFF_ENABLE_TRANSPARENCY_WARNINGS=1 ~/groff-HEAD/bin/groff -Tpdf /tmp/branden/naive-gbr2-latin1.groff >/dev/null
troff:/tmp/branden/naive-gbr2-latin1.groff:12: error: can't translate character code 239 to special character ':i' in transparent throughput

...and the hyperlinks even still work!

The tolerance for Latin-1 smuggling continues but is, however, something
I plan to change as noted earlier in the thread.

And at long last I feel I understand what that incomprehensible
diagnostic message needs to say. It's been a long time
coming--something like six years...

Regards,
Branden