Linux-man Archive mirror
 help / color / mirror / Atom feed
From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
To: Deri <deri@chuzzlewit.myzen.co.uk>
Cc: Alejandro Colomar <alx@kernel.org>,
	linux-man@vger.kernel.org, groff@gnu.org
Subject: Re: Bogus index in man-pages book from other projects
Date: Tue, 12 Mar 2024 15:49:28 -0500	[thread overview]
Message-ID: <20240312204928.nzowpxj2wmyawgk2@illithid> (raw)
In-Reply-To: <10631018.ZHfXn36Ih2@pip>

[-- 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-03-12 20:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 16:21 Bogus index in man-pages book from other projects Alejandro Colomar
2024-03-12 12:47 ` Deri
2024-03-12 14:12   ` Alejandro Colomar
2024-03-12 15:15     ` G. Branden Robinson
2024-03-12 18:25       ` Deri
2024-03-12 20:49         ` G. Branden Robinson [this message]
2024-03-12 15:39     ` Deri
     [not found]     ` <1873292.UaS1mDKzQr@pip>
2024-03-12 15:50       ` Alejandro Colomar
2024-03-12 16:20         ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240312204928.nzowpxj2wmyawgk2@illithid \
    --to=g.branden.robinson@gmail.com \
    --cc=alx@kernel.org \
    --cc=deri@chuzzlewit.myzen.co.uk \
    --cc=groff@gnu.org \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).