braillespecs / braille-css

Braille CSS specification
http://braillespecs.github.io/braille-css
2 stars 1 forks source link

Support multiple page counters #47

Open bertfrees opened 6 years ago

bertfrees commented 6 years ago

Currently there exists a special page counter:

A 'page' counter is created automatically on the root element. Its purpose is for numbering braille pages. The counter is implicitly incremented on each page. Depending on the implementation, explicitly setting or incrementing this counter may or may not have an effect. No new counters can be created with the name 'page'.

(see Creating and inheriting counters)

With the latest OBFL addition, page-number-counter, we could now support custom page counters.

Any counter that is manipulated in the page context would be a page counter. The counter named page would still be a special case in the sense that the default value of counter-increment inside the page context is page. However it would now become possible to overwrite this rule:

@page {
    counter-increment: my-page;
}

It is not allowed to have more than one page counter on the same page (e.g. counter-increment: page my-page). Having no page counter (counter-increment: none) could in theory be allowed. It is not allowed to access or manipulate the value of a page counter if it is not the page counter that is active on the current page.

The current behavior of the begin and end sections of volumes could be accomplished with these implicit rules:

@volume {
    @begin
        counter-set: pre-page;
        @page {
            counter-increment: pre-page;
        }
    }
    @end {
        counter-set: post-page;
        @page {
            counter-increment: post-page;
        }
    }
}
bertfrees commented 6 years ago

Something to think about is whether it should be disallowed to use target-counter(<page-counter-name>, <ref>) if the active page counter at <ref> is not <page-counter>.

bertfrees commented 6 years ago

https://github.com/daisy/pipeline-mod-braille/blob/c6f8e173ecf270d041d02ef6cc0300a45c9f58e0/pipeline-braille-scripts/dtbook-to-pef/src/main/resources/css/default.css#L62-L65