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 for :nth() page selectors #724

Closed
Smylers opened this issue Oct 31, 2018 · 7 comments
Closed

Support for :nth() page selectors #724

Smylers opened this issue Oct 31, 2018 · 7 comments
Labels
feature New feature that should be supported good first issue Issues that can be quite easily solved by Python developers with a good CSS background
Milestone

Comments

@Smylers
Copy link
Contributor

Smylers commented Oct 31, 2018

WeasyPrint doesn't yet support GCPM's page selectors and page groups, for being able to do things like have the first page of each chapter use different page headings and footers.

This is a documented limitation (and this isn't a complaint!). I'm just opening this now so that we have an issue URL to put in the comment of a workaround we've implemented; then any future developer on our code who encounters the workaround can easily check whether it's still necessary.

@liZe liZe added the feature New feature that should be supported label Oct 31, 2018
@liZe
Copy link
Member

liZe commented Oct 31, 2018

WeasyPrint doesn't yet support GCPM's page selectors and page groups, for being able to do things like have the first page of each chapter use different page headings and footers.

True, but it supports named pages that may be helpful for this case.

@Tontyna
Copy link
Contributor

Tontyna commented Oct 31, 2018

@page :nth would be a great feature, though a quick reflection about how to implement it results in: "I'm not eager to write the code."

@Smylers
Copy link
Contributor Author

Smylers commented Nov 1, 2018

named pages that may be helpful for this case.

Oh, so it is — thanks!

(Apparently I can't read. I'd looked at that and somehow given myself the impression that if an <h2> with a named page specified was immediately followed by a <p> in the default page type then there'd end up being a page-break between them. But I was wrong, and both CSS and WeasyPrint do exactly what I want here. Thank you.)

@LukasKlement
Copy link

I'm having exactly this issue at the moment, where I do not know how it can be solved without the :nth() page selector:

  • I am rendering trifold flyer, each page with columned content flowing from one page to the next
  • The pages are being merged in the correct order using pdfrw PDFMerge()
  • I need bleed to be on the outside borders, but not on the inside (page 1: <>mm <>mm <>mm 0; page 2: <>mm 0 <>mm <>mm; page 3: <>mm 0; etc.)

Since columns flow from one page to the next, I cannot use named pages. Setting a single bleed value will create the bleed also at the fold ... how would you solve this without the @page :nth() feature?

@liZe
Copy link
Member

liZe commented Nov 27, 2018

how would you solve this without the @page :nth() feature?

You probably can't, :nth() looks like the perfect solution for that!

The more I think about this feature, the more it seems easy to add… Of course, it's always "not that easy" in the end 😄. I'll check that soon.

@liZe liZe added the good first issue Issues that can be quite easily solved by Python developers with a good CSS background label Jan 4, 2019
@liZe
Copy link
Member

liZe commented Apr 2, 2019

:nth(x) and :nth(An+B) syntaxes have been added in the nth-page branch. I'd be happy to have some testers!

Does anyone need page groups here?

@liZe
Copy link
Member

liZe commented Apr 3, 2019

@Smylers I'll close this issue when :nth support is merged, and change the title accordingly. Would you mind opening a new issue for page groups if you are interested in the page groups issue?

@liZe liZe changed the title Support for page groups and :nth() page selectors Support for :nth() page selectors Apr 3, 2019
@liZe liZe added this to the 47 milestone Apr 3, 2019
@liZe liZe closed this as completed in #846 Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature that should be supported good first issue Issues that can be quite easily solved by Python developers with a good CSS background
Projects
None yet
Development

No branches or pull requests

4 participants