Hi there!
Is it possible to do things with counters inside @page rules yet? I found some forum posts saying that it's on the roadmap from before Prince 14's release, and that "Support for custom page counters." is included on the release notes for 14. I also saw the docs say this should work (assuming I'm not misinterpreting!):
https://www.princexml.com/doc/gen-content/#initializing-and-incrementing-counters
but when I try it it doesn't work how I expect:
I'm trying to get the rowOnPage counter to reset at the start of each page, so that there'll be $s at the first row of each page.
I've actually tried a few different approaches here with no luck (using page-policy, nasty hacks with JavaScript, etc.). Is there something I'm missing or is this impossible at the moment?
Is it possible to do things with counters inside @page rules yet? I found some forum posts saying that it's on the roadmap from before Prince 14's release, and that "Support for custom page counters." is included on the release notes for 14. I also saw the docs say this should work (assuming I'm not misinterpreting!):
https://www.princexml.com/doc/gen-content/#initializing-and-incrementing-counters
Note that the counter-increment and counter-reset properties can also be used in @page at-rules to create counters that track the page number, for example to number the pages within each chapter separately from the normal page and pages counters.
but when I try it it doesn't work how I expect:
<script>
Prince.addScriptFunc("dollarsOnFirstRow", function (page) {
return page == 1 ? "$" : "";
});
</script>
<style>
table {
counter-reset: rowOnPage;
}
@page {
counter-reset: rowOnPage;
}
.row {
counter-increment: rowOnPage;
}
.cell:before {
content: prince-script(dollarsOnFirstRow, counter(rowOnPage));
color: green;
}
</style>
<table>
<tr class="row">
<td class="cell">10</td>
<td class="cell">20</td>
<td class="cell">30</td>
<td class="cell">40</td>
</tr>
<!-- repeated a bunch for page breaks -->
</table>
I'm trying to get the rowOnPage counter to reset at the start of each page, so that there'll be $s at the first row of each page.
I've actually tried a few different approaches here with no luck (using page-policy, nasty hacks with JavaScript, etc.). Is there something I'm missing or is this impossible at the moment?