groff-commit
[Top][All Lists]
Advanced

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

[groff] 48/51: [mdoc]: Support AD string; sets default adj mode.


From: G. Branden Robinson
Subject: [groff] 48/51: [mdoc]: Support AD string; sets default adj mode.
Date: Sun, 11 Sep 2022 08:15:56 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 952c2f75c25b70a6ebe4d457339b4fdcefd00f3a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Sep 9 05:12:17 2022 -0500

    [mdoc]: Support AD string; sets default adj mode.
    
    * tmac/mdoc/doc-common (Sh): Set adjustment mode to user-specified
      default, not troff's default (and not only in troff mode).
    
    * tmac/mdoc/doc-ditroff:
    * tmac/mdoc/doc-nroff: Process `AD` string setting from command line as
      man(7) does.
    
    * tmac/groff_mdoc.7.man (Formatting with groff, troff, and nroff):
      Document it.
    
    * NEWS: Add and update items.
    
    Fixes part of <https://savannah.gnu.org/bugs/?63046>.
---
 ChangeLog             | 19 +++++++++++++++++++
 NEWS                  | 14 ++++++--------
 tmac/groff_mdoc.7.man | 24 ++++++++++++++++++++++++
 tmac/mdoc/doc-common  |  3 +--
 tmac/mdoc/doc-ditroff |  4 ++++
 tmac/mdoc/doc-nroff   |  6 ++++--
 6 files changed, 58 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6e4f6d26b..743f0a5e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2022-09-09  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [mdoc]: Support `AD` string to set default adjustment mode.
+
+       * tmac/mdoc/doc-common (Sh): Set adjustment mode to
+       user-specified default, not troff's default (and not only in
+       troff mode).
+
+       * tmac/mdoc/doc-ditroff:
+       * tmac/mdoc/doc-nroff: Process `AD` string setting from command
+       line as man(7) does.
+
+       * tmac/groff_mdoc.7.man (Formatting with groff, troff, and
+       nroff): Document it.
+
+       * NEWS: Add and update items.
+
+       Fixes part of <https://savannah.gnu.org/bugs/?63046>.
+
 2022-09-09  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/doc.tmac (doc-tag-list): Fix code style nit: don't give
diff --git a/NEWS b/NEWS
index 5e068e3bf..0d43a2f97 100644
--- a/NEWS
+++ b/NEWS
@@ -241,10 +241,10 @@ o Part of the an (man) macro package has been renamed 
from `an-old.tmac`
   this.  The man-db man(1) implementation has, since 2001, used
   "-mandoc" preferentially if available when man-db is configured.
 
-o The an (man) macro package supports a new `AD` string to put the
-  default adjustment mode under user control at rendering time.  The
-  default is "b" (adjust lines to both margins) as has been the Unix
-  man(7) default since 1979.
+o The an (man) and doc (mdoc) macro packages support a new `AD` string
+  to put the default adjustment mode under user control at rendering
+  time.  The default is "b" (adjust lines to both margins) as has been
+  the Unix man(7) default since 1979.
 
 o The an (man) and doc (mdoc) macro packages support new `CS` and `CT`
   registers to control rendering of man page section headings and titles
@@ -282,10 +282,8 @@ o The groff_man(7) man page documenting the groff 
implementation of the
   material supplemented with explanations, examples, and advice for the
   reader who is not an expert in *roff systems or in writing man pages.
 
-o The doc (mdoc) macro package now honors the C and HY registers as the
-  an (man) package does.  It furthermore recognizes the `AD` string (see
-  above) for compatibility with an (man), but at present ignores its
-  value.
+o The doc (mdoc) macro package now honors the `C` and `HY` registers as
+  the an (man) package does.
 
 o The e (me) macro package has changed its support for output line
   numbering with the `n1` and `n2` macros to resolve several bugs in the
diff --git a/tmac/groff_mdoc.7.man b/tmac/groff_mdoc.7.man
index e9a05bfec..ecf0e6cca 100644
--- a/tmac/groff_mdoc.7.man
+++ b/tmac/groff_mdoc.7.man
@@ -4559,6 +4559,30 @@ A normal user will never need it.
 .
 .Sh "Formatting with groff, troff, and nroff"
 .
+Setting string
+.Li AD
+configures the adjustment mode for most formatted text.
+.
+Typical values are
+.Li b
+for adjustment to both margins
+(the default),
+or
+.Li l
+for left alignment
+(ragged right margin).
+.
+Any valid argument to
+.Nm groff Ns No 's
+.Li .ad
+request may be used.
+.
+See
+.Xr groff @MAN7EXT@
+for less-common choices.
+.
+.D1 Li groff \-Tutf8 \-dAD=l \-mdoc groff_mdoc.7 | less \-R
+.
 Setting register
 .Ql C
 to\~1 numbers output pages consecutively,
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index c170a8469..9dd0731aa 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -1368,8 +1368,7 @@
 .    ds doc-macro-name Sh
 .    doc-parse-args \$@
 .
-.    if t \
-.      ad
+.    ad \*[AD]
 .
 .    \" this resolves, e.g., '.Sh "SEE ALSO"'
 .    doc-prepare-section-heading \$*
diff --git a/tmac/mdoc/doc-ditroff b/tmac/mdoc/doc-ditroff
index 0ff66785d..4f68d7f08 100644
--- a/tmac/mdoc/doc-ditroff
+++ b/tmac/mdoc/doc-ditroff
@@ -35,6 +35,10 @@
 .nr doc-is-output-html 0
 .if '\*[.T]'html' .nr doc-is-output-html 1
 .
+.\" Use -dAD to set the adjustment mode for ordinary body text.
+.if !d AD \
+.  ds AD b\"
+.
 .\" Use -rC1 to consecutively number pages across multiple documents.
 .\"
 .\" We must use consecutive page numbers when using PostScript to
diff --git a/tmac/mdoc/doc-nroff b/tmac/mdoc/doc-nroff
index 901100a06..db3d776fe 100644
--- a/tmac/mdoc/doc-nroff
+++ b/tmac/mdoc/doc-nroff
@@ -35,6 +35,10 @@
 .nr doc-is-output-html 0
 .if '\*[.T]'html' .nr doc-is-output-html 1
 .
+.\" Use -dAD to set the adjustment mode for ordinary body text.
+.if !d AD \
+.  ds AD b\"
+.
 .\" Use -rC1 to consecutively number pages across multiple documents.
 .\"
 .\" We must use consecutive page numbers when using PostScript to
@@ -159,8 +163,6 @@
 .
 .  nr doc-display-vertical 1v
 .  nr doc-line-length \n[.l]
-.  ad l
-.  na
 ..
 .ec
 .



reply via email to

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