Commit 31fc3eb2 authored by Fred Chasen's avatar Fred Chasen

Allow reseting page numbering

parent c01f0086
......@@ -149,7 +149,7 @@ class Breaks extends Handler {
}
}
afterLayout(pageElement, page) {
afterPageLayout(pageElement, page) {
this.addBreakAttributes(page);
}
}
......
......@@ -82,9 +82,7 @@ class Counters extends Handler {
let name = identifier && identifier.name;
let selector = csstree.generate(rule.ruleNode.prelude);
let counter;
if (name === "page") {
return;
}
if (!(name in this.counters)) {
counter = this.addCounter(name);
} else {
......@@ -164,6 +162,14 @@ class Counters extends Handler {
}
}
afterPageLayout(pageElement, page) {
let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]");
pgreset.forEach((reset) => {
let value = reset.datasetCounterPageReset;
this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-reset: page ${value} }`, this.styleSheet.cssRules.length);
});
}
}
export default Counters;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment