docbook / xslTNG

DocBook xslTNG Stylesheets
https://xsltng.docbook.org
MIT License
43 stars 22 forks source link

'page-break-inside: avoid;' on pre makes long programlisting overflow page #320

Closed tgraham-antenna closed 1 year ago

tgraham-antenna commented 1 year ago

https://github.com/docbook/xslTNG/blob/ebbbaa2e361f5aa3c5f9b4d18bb4109c55258f2e/src/main/scss/media-all.scss#L944-L950

See, e.g., page 45 of https://xsltng.docbook.org/pdf/DocBook-xslTNG-2.1.0.pdf

ndw commented 1 year ago

Bah humbug. Any suggestions for alternative properties that prevent breaks in short listings?

tgraham-antenna commented 1 year ago

Antenna House Formatter has -ah-keep-together-within-dimension (https://www.antenna.co.jp/AHF/help/en/ahf-ext.html#axf.keep-together-within-dimension) as well as numeric keep values with -ah-keep-together (https://www.antenna.co.jp/AHF/help/en/ahf-ext.html#css-xsl).

The alternative would be to specify page-break-before: avoid; on the first several lines (since you're formatting program listings as tables) and hope.

tgraham-antenna commented 1 year ago

Would it work to adapt the <?dbfo-need height="2in" ?> hackery described in http://www.sagehill.net/docbookxsl/PageBreaking.html#SoftPageBreaks?

ndw commented 1 year ago

Maybe. What's would you output for the "need" and how would you style it?

tgraham-antenna commented 1 year ago

For programlisting as a table, there's also -ah-table-row-orphans: https://www.antenna.co.jp/AHF/help/en/ahf-ext.html#axf.table-row-orphans