bug-bash
[Top][All Lists]
Advanced

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

[PATCH 03/18] doc/bash.1: fix latent bug in `QN` macro


From: G. Branden Robinson
Subject: [PATCH 03/18] doc/bash.1: fix latent bug in `QN` macro
Date: Wed, 31 Jan 2024 02:41:18 -0600

Whether it arises will depend on word placement and line length.

*roff has a simplistic notion of what a "word" is.

groff_man_style(7):
     ... The formatter troff(1) collects words from the input and fills
     output lines with as many as will fit.  Words are separated by
     spaces and newlines.  A transition to a new output line is called a
     break.  When formatted, a word may be broken at hyphens, at \% or
     \: escape sequences (see subsection “Portability” below), or at
     predetermined locations if automatic hyphenation is enabled (see
     the -rHY option in section “Options” below). ...

The input

.  if t \%``\%\\$1''\\$2

...tells the formatter that a hyphenation break is permitted after the
opening double quotation mark, like “‐
this”.  A hyphenation control escape sequence at the _beginning_ of a
word is treated specially.

groff_man_style(7):
     \%        Control hyphenation.  The location of this escape
               sequence within a word marks a hyphenation point,
               supplementing groff’s automatic hyphenation patterns.  At
               the beginning of a word, it suppresses any hyphenation
               breaks within except those specified with \%.
---
 doc/bash.1 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/bash.1 b/doc/bash.1
index 1c495378..9562d830 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -41,7 +41,8 @@
 .\"
 .\" File Name macro.  This used to be `.PN', for Path Name,
 .\" but Sun doesn't seem to like that very much.
-.\" The \% is to prevent the filename from hyphenation.
+.\"
+.\" \% at the beginning of a word protects it from hyphenation.
 .\"
 .de FN
 \%\fI\|\\$1\|\fP
@@ -57,11 +58,12 @@
 .  if n "\\$1"\\$2
 .\}
 ..
+.\" As Q, but don't permit automatic hyphenation of contents.
 .de QN
 .ie \n(.g \%\(lq\\$1\(rq\\$2
 .el \{\
-.  if t \%``\%\\$1''\\$2
-.  if n \%"\%\\$1"\\$2
+.  if t \%``\\$1''\\$2
+.  if n \%"\\$1"\\$2
 .\}
 ..
 .SH NAME
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]