Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid orphaned headlines (headline at the end of a volume) #88

Closed
josteinaj opened this issue Jul 11, 2017 · 15 comments
Closed

Avoid orphaned headlines (headline at the end of a volume) #88

josteinaj opened this issue Jul 11, 2017 · 15 comments

Comments

@josteinaj
Copy link
Member

Example:

<level1>
    <h1>...</h1>
    <p>...</p>
    <level2>
        <h2>...</h2>

Here, the h1 and p has a tendency to end up in the volume before level2.

@josteinaj
Copy link
Member Author

josteinaj commented Oct 9, 2017

See pending test here:

<x:scenario label="Content at start of part (or chapter) should be in same volume as first descendant chapter (or subchapter)" pending="https://github.com/nlbdev/pipeline/issues/88">

@bertfrees
Copy link
Collaborator

See daisy/pipeline-mod-braille#159

@bertfrees
Copy link
Collaborator

Related: #91

@bertfrees
Copy link
Collaborator

bertfrees commented Nov 8, 2017

We ended up not using -obfl-keep-with-next-sheets. Instead we simply treat the first level2 the same as the parent level1, so that there is no preference for breaking before the level2. Because a break before the level1 is more preferable than a break inside the level1, the chance of a break happening inside the level1 before the first level2 is smaller than the chance of a break happening inside the level2. This is exactly what we want.

(EDIT: The reasoning here is that the closer you get to a preferred break point, the bigger the chance is that you "snap" to that break point. Or in other words, it is more likely that an actual break point lies further away from a preferred one than close but not on it.)

bertfrees added a commit that referenced this issue Nov 8, 2017
@josteinaj
Copy link
Member Author

@KariRudjord and I discussed this today. We agreed that it should be as described by @bertfrees in the previous comment (#88 (comment)). In addition, we want to try having a -obfl-keep-with-next-sheets: 1; for the first child sections/levels to prevent orphaned headlines.

@bertfrees
Copy link
Collaborator

bertfrees commented Dec 19, 2017

@josteinaj What is the current status? I'm still assigned, but I see you updated and simplified the volume breaking CSS last week. The test ("Content at start of part should be in same volume as first descendant chapter") still passes. You didn't add the -obfl-keep-with-next-sheets yet though. Is that still the goal?

@josteinaj
Copy link
Member Author

@bertfrees I'll unassign you. I think I originally assigned this to you in a bulk of other volume breaking issues. Adding -obfl-keep-with-next-sheets is still the goal.

@josteinaj
Copy link
Member Author

As mentioned in #88 (comment), we want to try avoiding orphaned headlines by using -obfl-keep-with-next-sheets: 1;. This should only be needed for the first amongst sibling sections, i.e. //level1[1], //level1/level2[1], //level1/level2/level3[1], etc. where the -obfl-keep priority is the same for all levels.

I've pushed a test for orphaned headlines.

@bertfrees
Copy link
Collaborator

I've added the following CSS:

@for $i from 1 through 6 {
h#{$i} {
-obfl-keep-with-next-sheets: 1;
}
level#{$i} ~ level#{$i} > h#{$i} {
-obfl-keep-with-next-sheets: 0;
}
}

Note that for very small sections (smaller than one sheet) this might have an undesired effect, but I suggest you try it first. A solution could be to set keep-with-next-sheets: 1 only on the highest levels, or to set it based on some heuristic that involves guessing the size of the section.

Also note that keep-with-next-sheets will not work anymore across level1's because #91 got dropped (land evel1's start on a new right-hand page), but I don't expect that to be issue because I assume such short level1's are not so common.

@josteinaj
Copy link
Member Author

So for this to be a problem, I suppose there would for instance have to be a series of very short level2s containing very short level3s. And there would have to be enough of them so that they fill an entire volume... Right?

Would there potentially be some volume breaking exception, or would it just result in bad volume breaking?

@bertfrees
Copy link
Collaborator

Right, I think that's what I mean. But even if there are not enough to fill an entire volume, it may result in sheets being kept together when not desired. I don't think it would cause exceptions. Just non-optimal volume breaking.

@josteinaj
Copy link
Member Author

Ok. I'll move this to "Ready for test", and we'll see what @KariRudjord has to say.

@josteinaj
Copy link
Member Author

...or "Ready for deployment" for now. I suppose this should wait until the system is fully updated to the latest DP2 release.

@KariRudjord
Copy link

In DTBook 561894 first volume ends with the page Part 1. It should be the first page in vol. 2. (much text in preface in this partiuclar book) @josteinaj will add some rule saying keep with next page to avoid this.

@josteinaj josteinaj self-assigned this Jun 4, 2018
@josteinaj
Copy link
Member Author

We agreed some weeks ago that instead of moving content from the start of a part or chapter into the same volume as first descendant chapter or subchapter, we want to maximize the number of pages used in each volume. However, if the content is very short (for instance just a headline), then we still want to make sure that it is in the same volume as the first following content section, so that we avoid orphaned headlines. I'm trying to get this working using the -obfl-keep-with-next-sheets CSS property, but it doesn't work in this particular case. See issue #91.

@josteinaj josteinaj changed the title Content at start of part (or chapter) should be in same volume as first descendant chapter (or subchapter) Avoid orphaned headlines (headline at the end of a volume) Jun 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants