Forum How do I...?

inserting text when element spans page-break

ollieman
What I want to do is have prince insert text when a particular div or other element spans a page-break. It would look something like this:

SECTION 2
This is a paragraph and it is a
          (cont'd)
          
----------page break----------
          
SECTION 2 (cont'd)
really great paragraph. I can tell.


While the paragraph would, of course, just be this:

SECTION 2
This is a paragraph and it is a really great paragraph. I can tell.


Is this possible?
mikeday
This is not currently possible, but we are investigating ways of supporting this in the future.
mophor
I think this is related to this part:
http://www.w3.org/TR/css3-gcpm/#continuation

which is pretty blank still indeed.

As a suggestion, add a ::break pseudo element (I think ::marker is not enough, because there might be a break in list items as well and you will need both). The break pseudo element represents the page break (maybe other types of breaks as well - column breaks for example):

,--------------------------------.
| ,---.   ,----.          ,---.  |
| | B | C | Br | C cont'd | A |  |
| `---'   `----'          `---'  |
`--------------------------------'

Where C is the content, B the ::before pseudo, A the ::after pseudo and Br the ::break pseudo

the above content might be generated in ::break::before and ::break::after. More specific:
p::break::before {
  display: block;
  text-align: center;
  content: "(cont'd)";
}
p::break::after {
  display: block;
  text-align: left;
  content: "SECTION " counter(section) " (cont'd)";
}


more common would be just
p::break::before {content: "..."}
p::break::after {content: "..."}
}

I guess

Edited by mophor

mikeday
Something along those lines might work, although currently selectors can't contain more than one pseudo-element, so it might be better to use two separate pseudo-elements rather than ::before::before and ::break::after. (Besides, what would go in ::break?)
mophor
considering the css3 generated content module working draft, nested pseudo elements might become part of the spec, so this might need to be implemented anyway. (http://www.w3.org/TR/css3-content/#nesting)

Inside the ::break lives the page or column break itself. Maybe setting ::break{display:none} would be equivalent to page-break-inside: avoid.

Obviously, the content of the ::break would be some virtual page break, but it might for instance have border or margin properties. This would also add the possibility to adjust the following:

,--------------------------------. 
|                                | 
|          paragraph             | 
|                                | 

          <<break>>

|                                | 
|       paragraph cont'd         | 
|                                | 
`--------------------------------' 

and
,--------------------------------. 
|                                | 
|          paragraph             | 
|                                | 
`--------------------------------'
          <<break>>
,--------------------------------. 
|                                | 
|       paragraph cont'd         | 
|                                | 
`--------------------------------' 


by specifying the ::break's borders
mikeday
That's quite clever, although perhaps a little too clever! :)

There has been a proposed property called "border-break" in CSS3 for some time that specifies the border style used at a page break (and presumably column break). However, this does not address the issue of whether padding should also be repeated around the break or not.
howcome
How about adding these two new pseudo-classes?:

::before-break {
content: image(to-arrow.png);
}
::after-break {
content: image(from-arrow.png);
}

-h&kon
ollieman
Is this possible in Prince 7?
mikeday
We've added the prince-border-break property in Prince 7.1, which you can download now if you can guess the correct download URL. :)