groff
[Top][All Lists]
Advanced

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

Truncate the last lines of a diversion to another diversion


From: Selve
Subject: Truncate the last lines of a diversion to another diversion
Date: Thu, 5 Jan 2023 11:32:33 -0500

Hi,

In the macro package I am working on, I want to divert some text to a
region.  If the region is too small, I have to recuperate the text that
could not fit in and put it in another diversion, to output it later.
The way I know the region is full is by a trap positioned at its end.

Here is, in its essence, what I have tried:

$ cat problem.tr
.ll 40m
.wh 1v CUT
.de CUT
.  di TEXT2
.  di
..
.di TEXT
A paragraph that is long enough to be used as an example for my
question. 
.br
.di
.nf
.TEXT
-----
.TEXT2
.fi

The idea is to create the second diversion in the trap, to accumulate
what the first one had not outputed when the trap has sprung.

The output is:

$ preconv problem.tr | nroff
A paragraph that is long enough to be
used as an example for my question.
‐‐‐‐‐

What I would like to have is:

$ preconv solution.tr | nroff
A paragraph that is long enough to be
‐‐‐‐‐
used as an example for my question.

Is there a way to make it work?

Thank you very much,
Selve



reply via email to

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