groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/04: [man,mdoc]: Draw post-page line more consistently.


From: G. Branden Robinson
Subject: [groff] 01/04: [man,mdoc]: Draw post-page line more consistently.
Date: Fri, 1 Oct 2021 07:53:02 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 6dd1a8f801f94543bb790e2fcbb38c2161e928bb
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Sep 30 18:41:53 2021 +1000

    [man,mdoc]: Draw post-page line more consistently.
    
    [man, mdoc]: Draw line after each page more consistently in continuous
    rendering mode.
    
    * tmac/an.tmac (an-bp): Move responsibility for line-drawing after each
      document from here...
    
      (an-end): ...to here.  Refactor; drop
      `an-do-draw-line-after-document` register in favor of testing `\n[.F]`
      for nullity; if it is not null, then another document is due to be
      processed (in fact, `.F` already contains its file name), and we need
      to draw a separating line.  If it is null, we have reached the end of
      input and none is necessary.
    
    * tmac/mdoc/doc-ditroff.tmac (doc-setup-page-layout):
    * tmac/mdoc/doc-nroff.tmac (doc-setup-page-layout): Save configured line
      length in new register `doc-line-length`.
    
    * tmac/mdoc/doc-common.tmac (doc-end-macro): Port the above man(7)
      feature to mdoc(7); draw a line of this length after each document if
      continuously rendering.
---
 ChangeLog             | 21 +++++++++++++++++++++
 tmac/an.tmac          | 25 +++++++++++--------------
 tmac/mdoc/doc-common  |  9 +++++++++
 tmac/mdoc/doc-ditroff |  1 +
 tmac/mdoc/doc-nroff   |  1 +
 5 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 065c464..84c5ac8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2021-09-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man, mdoc]: Draw line after each page more consistently in
+       continuous rendering mode.
+
+       * tmac/an.tmac (an-bp): Move responsibility for line-drawing
+       after each document from here...
+       (an-end): ...to here.  Refactor; drop
+       `an-do-draw-line-after-document` register in favor of testing
+       `\n[.F]` for nullity; if it is not null, then another document
+       is due to be processed (in fact, `.F` already contains its file
+       name), and we need to draw a separating line.  If it is null, we
+       have reached the end of input and none is necessary.
+
+       * tmac/mdoc/doc-ditroff.tmac (doc-setup-page-layout):
+       * tmac/mdoc/doc-nroff.tmac (doc-setup-page-layout): Save
+       configured line length in new register `doc-line-length`.
+       * tmac/mdoc/doc-common.tmac (doc-end-macro): Port the above
+       man(7) feature to mdoc(7); draw a line of this length after each
+       document if continuously rendering.
+
 2021-10-01  Keith Marshall  <keith.d.marshall@ntlworld.com>
 
        [ms]: Update footnote handling documentation.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 4cab17d..400f7ba 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -92,20 +92,9 @@
 .  rr an-amount
 ..
 .
-.\" This .bp replacement for continuous rendering mode draws a
-.\" horizontal line after each document if there is more than one, and
-.\" adjusts the page length to the current position so that no empty
-.\" lines are inserted.
+.\" This .bp replacement for continuous rendering mode adjusts the page
+.\" length to the current position so that no empty lines are inserted.
 .de an-bp
-.  ie \\n[an-do-draw-line-after-document] \{\
-.    pl +1v
-.    nf
-.    ti 0
-\D'l \\n[LL]u 0'
-.    fi
-.  \}
-.  el \
-.    nr an-do-draw-line-after-document 1
 .  pl \\n[nl]u
 ..
 .
@@ -117,6 +106,15 @@
 .  pl +1v
 .  sp 1v
 .  an-footer
+.  \" If we're processing multiple documents and have started a new one,
+.  \" draw a line between this footer and the next header.
+.  if !'\\n[.F]'' \{\
+.    pl +1v
+.    nf
+.    ti 0
+\D'l \\n[LL]u 0'
+.    fi
+.  \}
 .  bp
 ..
 .
@@ -886,7 +884,6 @@
 .nr an-devtag-needs-end-of-heading 0
 .nr an-devtag-needs-second-column 0
 .
-.nr an-do-draw-line-after-document 0
 .nr an-is-first-page-of-document 1
 .
 .nr an-is-output-html 0
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 509927c..33c414b 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -1034,6 +1034,15 @@
 .    pl +1v
 .    sp 1v
 .    tl 
\*[doc-caption-font]\*[doc-operating-system]\f[]\*[doc-caption-font2]\*[doc-date-string]\f[]\*[doc-caption-font]\*[doc-operating-system]\f[]
+.    \" If we're processing multiple documents and have started a new
+.    \" one, draw a line between this footer and the next header.
+.    if !'\n[.F]'' \{\
+.      pl +1v
+.      nf
+.      ti 0
+\D'l \n[doc-line-length]u 0'
+.      fi
+.    \}
 .    \" suppress empty lines after the footer
 .    pl \n[nl]u
 .  \}
diff --git a/tmac/mdoc/doc-ditroff b/tmac/mdoc/doc-ditroff
index 33f5122..0964e82 100644
--- a/tmac/mdoc/doc-ditroff
+++ b/tmac/mdoc/doc-ditroff
@@ -157,6 +157,7 @@
 .  po 1i
 .
 .  nr doc-display-vertical .5v
+.  nr doc-line-length \n[.l]
 ..
 .ec
 .
diff --git a/tmac/mdoc/doc-nroff b/tmac/mdoc/doc-nroff
index e2f8881..c0d8962 100644
--- a/tmac/mdoc/doc-nroff
+++ b/tmac/mdoc/doc-nroff
@@ -146,6 +146,7 @@
 .  po 0i
 .
 .  nr doc-display-vertical 1v
+.  nr doc-line-length \n[.l]
 .  ad l
 .  na
 ..



reply via email to

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