Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the `:nth()` page selector. #846

Merged
merged 21 commits into from Apr 10, 2019

Conversation

1 participant
@liZe
Copy link
Member

liZe commented Apr 3, 2019

Fix #724.

This PR also includes the original work for media queries, as discussed in #494.

I would have loved to include page groups, but that's a lot of work and I'd love to spend my time on other issues before.

liZe added some commits Aug 17, 2018

Use empty string as default value of named page
That's the value given in the spec, using None doesn't add anything and even
introduces bugs.
Add page declarations on demand
With the previous system, we were listing all page types as the cartesian
product of page names and pseudo selectors. Declarations were added for all
these possible page types.

The nth() page selector makes this system impossible, as we can't make the
cartesian product with a number of pages we don't know at the beginning of the
rendering. We now add declarations before rendering each page, based on the
properties of the page.

This new way is faster when the total number of pages is lower than the
cartesian product of possible pages. For long documents, we could improve speed
by detecting CSS rules based on page index or page name, and use cached results
for all pages that don't rely on such rules.

@liZe liZe added this to the 47 milestone Apr 3, 2019

@liZe liZe merged commit 5a2553e into master Apr 10, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.