Repository navigation
Introduce second variant of Ignorant Behaviour and prevent weak page breaks at basically empty pages - #1929
Conversation
|
I definitely see the value fo the page counter though. I do not really see the motivation for the |
|
Moreover, I think a fifth Behaviour would be more fitting. The idea behind |
As far as I remember, when coming to the behaviour of place, the discussion was unclear. Will a place trigger a weak page break or might there be cases, where a place could be invisible? |
|
I think until it's established as a problem how place interacts with weak pagebreaks there is no reason to change it. |
|
ok. |
|
Please, have a look. |
|
Please consider #1997 to calm clippy down even more and get a test pass... |
|
the fmt error is addressed in #1999 |
|
@laurmaedje You are deeper inside the code ... Are there any open concerns with this implementation? |
|
I haven't yet merged because I wanted to carefully review to check whether it works as intended. I probably won't have time to do that in the next few days (I'm travelling at the moment), but hopefully next Wednesday or so. |
|
I experimented a bit with it and thought a bit about it and it seems to work correctly. Thanks! |
|
This PR broke the following snippet: #pagebreak(weak: true)
#bibliography("...")It nows fails with "the document does not contain a bibliography" because the weak pagebreaks stops the basically empty page after it from being used and then the bibliography metadata just vanishes into the void. Independently of this PR, the following snippet produces a Typst document without pages: #pagebreak(weak: true)Unfortunately, the whole code around this is quite brittle. :/ See also: #2134 |
|
So better revert for now and create a set of tests first that have to pass? |
|
I would rather not revert, as that would regress the other bug that was fixed by this, which also isn't great. I hope we can find a way to fix this / make it good enough. Medium-term this all needs a refactoring ... |
|
Ok. What behaviour is bibliography? As the changeset was not large, it might be not too difficult to find with the debugger. |
|
The relevant thing is |
|
Sure? I'm not with an ide or compiler now, but parbuilder seems at least suspicious to me: |
|
Both might be problematic, but the pagebreak is definitely more problematic because if you replace that |
|
Just a question. in behave.rs BehavedBuilder::push() Could we handle Ignorant and invisible differently? If we pushed invisible elements directly to the builder, I mean they are invisible, would that break order in some way? |
|
That would probably break the |
|
As far as I understand, the staged items are never simply deleted. Might there just be missing a final flush of the staged items? Normally this is done in interrupt_page() and this is indeed not happening when the page is basically empty. But should only be any problem on the last page. At every other location some pagebreak will happen and therefore do the flush. So just a hypothesis: In the last interrupt_page() call in realize_layout(). When you have still staged elements there but no new page is created, those elements may need to be pushed onto the last page. Would that somehow suffice? |
|
Or can they be pushed after the page without creating a new page? |
I think it makes sense. I did try something like that yesterday, but didn't get it to work without breaking everything. But probably it was only because it was late and I was tired. I tried again and it seems to work this time around: #2141 |
|
When you put another invisible element at the end of the document, let's say metadata (which in contrast will not generate any visible content in the document), will that result in an empty page then? |
…breaks at basically empty pages (typst#1929)
This is inspired by and in some way alternative to #1500 and also attempts to fix #1346.
Stands for discussion.