groff-commit
[Top][All Lists]
Advanced

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

[groff] 47/49: [mdoc]: Set page topic in roman in "Name" section.


From: G. Branden Robinson
Subject: [groff] 47/49: [mdoc]: Set page topic in roman in "Name" section.
Date: Sun, 6 Nov 2022 00:37:24 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 0d85615c62d07b028b972dff38bfa7589dad8cf1
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 5 00:48:23 2022 -0500

    [mdoc]: Set page topic in roman in "Name" section.
    
    * tmac/doc.tmac (Nm): If in the "Name" section of the page, set
      argument(s) with the `No` (normal formatting) macro instead of
      handling them...normally.  Since `Nm`'s usual behavior is to set the
      next argument in boldface, in this circumstance it is set in roman.
      Aligns page rendering with man(7) and fixes a bug documented in the
      4.3BSD-Reno mdoc.samples(7) page (1990-06-22)[1], upon which the
      groff_mdoc(7) page is based.
    
    * tmac/groff_mdoc.7.man (Bugs): De-document bug.
    
    Fixes part of <https://savannah.gnu.org/bugs/?62926>.
    
    [1] 
https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/share/man/man7/mdoc.samples.7
    
    Tested with the following stripped-down page.
    
    '\" t
    .\" groff_mdoc.man
    .\"
    .\"   A complete reference of the mdoc macro package for GNU troff.
    .\"
    .\" Based on NetBSD's mdoc.samples.7, version 1.21.
    .\"
    .\"
    .\"   Warning: You can't format this file with the old mdoc macros!
    .\"
    .\"
    .\" Copyright (C) 1990, 1993
    .\"   The Regents of the University of California.  All rights reserved.
    .\"
    .\" Redistribution and use in source and binary forms, with or without
    .\" modification, are permitted provided that the following conditions
    .\" are met:
    .\" 1. Redistributions of source code must retain the above copyright
    .\"    notice, this list of conditions and the following disclaimer.
    .\" 2. Redistributions in binary form must reproduce the above copyright
    .\"    notice, this list of conditions and the following disclaimer in
    .\"    the documentation and/or other materials provided with the
    .\"    distribution.
    .\" 3. [Deleted.  See
    .\"     ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change]
    .\" 4. Neither the name of the University nor the names of its
    .\"    contributors may be used to endorse or promote products derived
    .\"    from this software without specific prior written permission.
    .\"
    .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS"
    .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    .\" PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
    .\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    .\" SUCH DAMAGE.
    .\"
    .\"     @(#)mdoc.samples.7 8.2 (Berkeley) 12/30/93
    .\"
    .\" This reference invokes every macro in the package several times and
    .\" is guaranteed to give worst-case performance for an already
    .\" extremely slow package.
    .\"
    .
    .Dd 5 November 2022
    .Dt groff_mdoc 7
    .Os groff 1.23.0.rc1.3305-dc98a
    .
    .
    .Sh Name
    .
    .Nm groff_mdoc
    .Nd compose BSD-style manual (man) pages with GNU
    .Xr roff
    .
    .
    .Sh Description
    .
    Blah.
    .
    .Ss Names
    .
    The
    .Ql \&Nm
    macro is used for the document title or page topic.
    .
    Upon its first call,
    it has the peculiarity of remembering its argument,
    which should always be the topic of the man page.
    .
    When subsequently called without arguments,
    .Ql \&Nm
    regurgitates this initial name for the sole purpose of making less work
    for the author.
    .
    Use of
    .Ql \&Nm
    is also appropriate when presenting a command synopsis for the topic of
    a man page in section 1,
    6,
    or 8.
    .
    Its behavior changes when presented with arguments of various forms.
    .
    .
    .Pp
    .Bl -tag -width ".Li .Nm\ groff_mdoc" -compact -offset 15n
    .It Li ".Nm groff_mdoc"
    .Nm groff_mdoc
    .It Li ".Nm"
    .Nm
    .It Li ".Nm \e\-mdoc"
    .Nm \-mdoc
    .It Li ".Nm foo ) ) ,"
    .Nm foo ) ) ,
    .It Li ".Nm :"
    .Nm :
    .El
    .
    .
    .Pp
    By default,
    the topic is set in boldface to reflect its prime importance in the
    discussion.
    .
    Cross references to other man page topics should use
    .Ql \&Xr ;
    including a second argument for the section number enables them to be
    hyperlinked.
    .
    By default,
    these are set in italics to avoid cluttering the page with boldface.
    .
    .
    .Pp
    The default width is 10n.
---
 ChangeLog             | 15 +++++++++++++++
 tmac/doc.tmac         | 11 ++++++++---
 tmac/groff_mdoc.7.man |  8 --------
 3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e59815725..51772ba24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2022-11-05  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [mdoc]: Set page topic in roman in "Name" section.
+
+       * tmac/doc.tmac (Nm): If in the "Name" section of the page, set
+       argument(s) with the `No` (normal formatting) macro instead of
+       handling them...normally.  Since `Nm`'s usual behavior is to set
+       the next argument in boldface, in this circumstance it is set in
+       roman.  Aligns page rendering with man(7) and fixes a bug
+       documented in the 4.3BSD-Reno mdoc.samples(7) page (1990-06-22),
+       upon which the groff_mdoc(7) page is based.
+       * tmac/groff_mdoc.7.man (Bugs): De-document bug.
+
+       Fixes part of <https://savannah.gnu.org/bugs/?62926>.
+
 2022-11-05  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/mdoc/doc-common: Add internal register
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index 3ee5802da..d922f9349 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -1039,8 +1039,13 @@
 .de Nm
 .  if !\n[doc-arg-count] \{\
 .    ds doc-macro-name Nm
-.    ie \n[.$] \
-.      doc-parse-args \$@
+.    ie \n[.$] \{\
+.      \" Handle '.Nm ...' in "Name" section: don't use a special font.
+.      ie \n[doc-in-name-section] \
+.        No \$@
+.      el \
+.        doc-parse-args \$@
+.    \}
 .    el \{\
 .      ie "\*[doc-topic-name]"" \
 .        tm Usage: .Nm name ... (#\n[.c])
@@ -1082,7 +1087,7 @@
 .        doc-parse-space-vector
 .    \}\}
 .    el \{\
-.      \" handle '.Nm ...' in SYNOPSIS
+.      \" Handle '.Nm ...' in "Synopsis" section.
 .      if \n[doc-in-synopsis-section] \{\
 .        if "\*[doc-macro-name]"Nm" \{\
 .          br
diff --git a/tmac/groff_mdoc.7.man b/tmac/groff_mdoc.7.man
index eaffca5e0..6f55d679e 100644
--- a/tmac/groff_mdoc.7.man
+++ b/tmac/groff_mdoc.7.man
@@ -5040,14 +5040,6 @@ Section 3f has not been added to the header routines.
 .
 .
 .Pp
-The font used by
-.Ql .Nm
-should be changed in the
-.Em Name
-section.
-.
-.
-.Pp
 .Ql .Fn
 needs to have a check to prevent splitting up the line if its length is
 too short.



reply via email to

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