Support @page named selectors, selector lists, size, and the page property - #214
Merged
Merged
Conversation
…perty @page only accepted a single ":pseudo" selector, so a named page ("@page chapter") or a selector list ("@page chapter1:left, chapter2:left") was dropped, and neither the "size" descriptor nor the "page" property was recognised. Rewrite PageSelector to hold a list of PageSelectorEntry (name + pseudo), and CreatePageSelector to parse the CSS Paged Media 3 4.1 grammar per comma-separated entry. Add the "size" @page descriptor (a page-size/orientation keyword or one or two lengths) and the "page" property, with StyleDeclaration.Size / PageName accessors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature
CSS Paged Media 3 named page selectors, selector lists, the
sizedescriptor and thepageproperty:On
master,@pageaccepts only a single:pseudoselector — a named page or a selector list is dropped — and neithersizenorpageis recognised.Implementation
PageSelectornow holds a list ofPageSelectorEntry(Name+Pseudo), andCreatePageSelectorparses the §4.1 grammar per comma-separated entry: an optional<ident>page name then an optional:<ident>pseudo-class.@page :leftstill works.size@pagedescriptor (§6.3) — a page-size/orientation keyword (A4,letter,landscape) or one or two lengths — and thepageproperty (§3.4), withStyleDeclaration.Size/PageNameaccessors.Tests
14 cases in
PropertyTests/PageRuleTests.cs: six selector forms (pseudo-only, name-only, name+pseudo, multi-entry lists), the exposedPageSelectorEntrylist, fivesizevalues, and thepageproperty.The full suite (1263 existing tests) stays green — including the existing
@page :left { size:A4; … @bottom-right{…} }test — and all seven target frameworks build with no new warnings.PageSelector's constructor changed fromPageSelector(string)toPageSelector(IEnumerable<PageSelectorEntry>). It's a public type; flagging the source-compat change, though nothing in the library or tests constructed it directly.