I've managed to approximate the formatting of screenplay dialog, specifically when dialog is broken at a page, the text "(MORE)" is rendered at the bottom of the first page, the character name is repeated on the next page with " (CONT'D)" appended to it, and the remaining dialog comes after that. I've attached a picture to make this a lot clearer.
I find my solution rather sloppy: I've used tables, but not table-header-group, rather setting the caption content to be the "character" attribute of the table, with " (CONT'D)" appended; then I've used "dialog-start" class to set a named string "more-dialog" to "(MORE)" and reset the same string to "" at "dialog-end" class. It seems to work, but it's hardly elegant.
The HTML (assume auto page break comes within "td.dialog"):
And the CSS:
What I'd really like to do is dispense with the "dialog-start" and "dialog-end" classes and instead just set the "more-dialog" string with "table.dialog:before" and reset it with "table.dialog:after" but this does not appear to work, unless I'm doing it wrong?
Otherwise, is there a better way to achieve the same result, maybe without tables?
I find my solution rather sloppy: I've used tables, but not table-header-group, rather setting the caption content to be the "character" attribute of the table, with " (CONT'D)" appended; then I've used "dialog-start" class to set a named string "more-dialog" to "(MORE)" and reset the same string to "" at "dialog-end" class. It seems to work, but it's hardly elegant.
The HTML (assume auto page break comes within "td.dialog"):
<table class="dialog" character="BOBBY WOMACK">
<caption />
<tr><td class="dialog-start"></td></tr>
<tr><td class="character">BOBBY WOMACK</td></tr>
<tr><td class="dialog">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec hendrerit tempor tellus.</td></tr>
<tr><td class="dialog-end"></td></tr>
</table>
And the CSS:
@page screenplay {
@bottom-left {
font-family: 'Courier','Courier New';
font-size: 12pt;
content: string(more-dialog, last);
margin-left: 2in;
vertical-align: top;
}
}
table.dialog {
margin-top: 1em;
margin-bottom: 1em;
margin-left: 1in;
border-spacing: 0px;
width: 4in;
caption-side: top;
caption-page: following;
string-set: character attr(character);
}
td {
display: block;
}
td.character {
margin-left: 1in;
page-break-after: avoid;
}
td.dialog {
width: 3.5in;
orphans: 2;
widows: 2;
}
caption {
margin-left: 1in;
text-align: left;
content: string(character, last)" (CONT'D)";
}
td.dialog-start {
height: 0in;
string-set: more-dialog "(MORE)";
}
td.dialog-end {
height: 0in;
string-set: more-dialog "";
}
What I'd really like to do is dispense with the "dialog-start" and "dialog-end" classes and instead just set the "more-dialog" string with "table.dialog:before" and reset it with "table.dialog:after" but this does not appear to work, unless I'm doing it wrong?
Otherwise, is there a better way to achieve the same result, maybe without tables?