Is there a mechanism similar to testpage to check how many lines of text remain on a page but to do something other than issue a page break?
I would like to determine if there are more than say, 10 lines, remaining on the page, and if there are, fill that space with some sort of decoration. And if the space isn't there, just issue a plain page break.
I've taken a look at the source code for page breaks, but the plain tex is a bit too much for me to understand.
A minimal example would look something like:
\setuppapersize[A5]
\starttext
\input knuth
\testpage[10]
% Since testpage didn't fire, insert a small graphic here
% (this image is being added manually because I know there is space left,
% but I would like an automatic way to determine if there is space)
\vfill
\midaligned{\externalfigure[dummy][height=0.3\textheight]}
\vfill
\page[yes]
\input knuth
\input knuth
\testpage[10]
% Since testpage did fire, leave as is
\input knuth
\stoptext



