bugGNU roff - Bugs: bug #64206, [mm] `INDP` macro produces blank...

 
 

bug #64206: [mm] `INDP` macro produces blank page at end

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Wed 17 May 2023 09:02:57 AM UTC
   
 
Category:  Macro package mm Severity:  2 - Minor
Item Group:  Documentation Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.24.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 12 Jul 2023 06:01:47 PM UTC, comment #3: 

Overlooked this one when I last pushed.


commit 7b02f6a6bc7dc8d10dcd553499dce0be3ad1eadf
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Thu May 25 06:12:54 2023 -0500

    groff_mm(7): Clarify operation of `INDP` macro.

    * contrib/mm/groff_mm.7.man (Macros) <INDP>: Clarify operation.

    Fixes <https://savannah.gnu.org/bugs/?64206>.

    Also adjust dead-tree pagination.


G. Branden Robinson <gbranden>
Group administrator
Thu 01 Jun 2023 02:47:45 PM UTC, comment #2: 

Fixed on my branch.


commit 7b02f6a6bc7dc8d10dcd553499dce0be3ad1eadf
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Thu May 25 06:12:54 2023 -0500

    groff_mm(7): Clarify operation of `INDP` macro.

    * contrib/mm/groff_mm.7.man (Macros) <INDP>: Clarify operation.

    Fixes <https://savannah.gnu.org/bugs/?64206>.


G. Branden Robinson <gbranden>
Group administrator
Thu 18 May 2023 07:52:52 AM UTC, comment #1: 

Turns out that most of this is the same issue as bug #64207.  Rather than closing as a duplicate, I'm drastically reducing its scope.

And happily, this also gives me more confidence in that change.


$ git checkout e65938aac
[...]
$ cat EXPERIMENTS/use-index.mm
.INITI N myindex
.P
This is my document.
.IND "first item"
.IND "item, first"
.bp
.P
Here is some more stuff.
.IND "second item"
.IND "item, second"
This concludes our regularly scheduled programming.
.
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.
.INDP
$ ./build/test-groff -mm -Tascii EXPERIMENTS/use-index.mm | cat -s

                                   - 1 -

       This is my document.

                                   - 2 -

       Here  is  some  more  stuff.   This  concludes our regularly
       scheduled programming.  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

                                   - 3 -

       sunt, explicabo.

                                   - 4 -

                                  INDEX

       first item      1
       item, first     1
       item, second    2
       second item     2

                                   - 5 -

$ git checkout 50ec7561d
Previous HEAD position was e65938aac [man]: Preserve user-selected font family.
HEAD is now at 50ec7561d [mm]: Fix Savannah #64207.
$ ./build/test-groff -mm -Tascii EXPERIMENTS/use-index.mm | cat -s

                                   - 1 -

       This is my document.

                                   - 2 -

       Here  is  some  more  stuff.   This  concludes our regularly
       scheduled programming.  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.

                                   - 3 -

                                  INDEX

       first item      1
       item, first     1
       item, second    2
       second item     2

                                   - 4 -

$ git show
[...]
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index c679a7089..0b2878c89 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -1297,6 +1297,7 @@ numeric; got '\\$1'
 .\" stop output and begin on next page. Fix footnotes and all that.
 .de pg@next-page
 .\".debug next-page
+.br
 .ne 999i               \" activate trap
 .\" .pg@footer
 ..


So now there is just the matter of the trailing blank page, which is either a cosmetic or documentation issue.

(The commit IDs will likely not survive into the master branch.)

G. Branden Robinson <gbranden>
Group administrator
Wed 17 May 2023 09:02:57 AM UTC, original submission:  

Affects groff 1.22.4.


$ cat EXPERIMENTS/use-index.mm
.INITI N myindex
.P
This is my document.
.IND "first item"
.IND "item, first"
.bp
.P
Here is some more stuff.
.IND "second item"
.IND "item, second"
This concludes our regularly scheduled programming.
.INDP
$ mmroff -Tascii EXPERIMENTS/use-index.mm | cat -s

                                   - 1 -

       This is my document.

                                   - 2 -

       Here  is  some  more  stuff.   This  concludes our regularly

                                   - 3 -

       scheduled programming.

                                   - 4 -

                                  INDEX

       first item      1
       item, first     1
       item, second    2
       second item     2

                                   - 5 -


I see two problems here.

A.  The page is being broken before the index without flushing the pending output line first.  This smells like a missing `br` request to me.

B.  The page is being broken after the index even if there is no further content.

One can apparently redefine `TYIND` to get around the first problem.  It would be better to use `TXIND` for this purpose, and if it is not defined, call `SK` (or something similar) as the fallback for `TYIND` currently does.


.de INDP
.ie \\n[Ref] .tm .\\\\" Index: \\*[ind*file]
.el \{\
.       if !\\n[Cp] .pg@next-page
.       \" print INDEX
.       \" execute user-defined macros
.       if d TXIND .TXIND
.       ie d TYIND .TYIND
.       el \{\
.               SK
.               ce
\\*[Index]
.               SP 3
.               2C
.               nf
.       \}
'       so  \\*[ind*file]
.       ie d TZIND .TZIND
.       el \{\
.               fi
.               1C
.       \}
.\}
.rm ind*file
..


It's a shame the default operation wastes a page at the end of the document in (what I assume is) the common case of having no material in the document after the index.  (I assume not everybody sticks on a colophon or whatever.)

Possibly `INDP` could take a pair of arguments controlling whether the page is broken before and after, respectively.  It would of course pass these arguments to the appropriate hook macros.

G. Branden Robinson <gbranden>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-07-18 gbranden Item GroupRendering/Cosmetics Documentation
    2023-07-12 gbranden StatusReady for Merge Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.24.0
    2023-06-01 gbranden StatusIn Progress Ready for Merge
    2023-05-25 gbranden Assigned toNone gbranden
    2023-05-25 gbranden StatusConfirmed In Progress
    2023-05-18 gbranden Severity3 - Normal 2 - Minor
        Item GroupIncorrect behaviour Rendering/Cosmetics
        StatusNone Confirmed
        Summary[mm] indexing system paginates badly [mm] `INDP` macro produces blank page at end

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code