Handle ::first-letter #407

Merged
merged 7 commits into from Feb 16, 2017

Conversation

Projects
None yet
1 participant
@liZe
Member

liZe commented Jan 2, 2017

The feature comes with a couple of small fixes:

  • always use :: instead of : for internal representation of pseudo-classes, and
  • rename pseudo_to_box into before_after_to_box to avoid confusion with other pseudo classes.

If you're interested in this feature, please review before I merge!

liZe added some commits Dec 4, 2016

Initial support of ::first-letter
The pseudo-element is currently added at the end of the build, but it
should be done during the layout as the whitespaces at the beginning of
the tags may be skipped.
Carefully check first-letter's char category
Use only the punctuation categories listed in the spec.
Always use two colons for pseudo-elements
Tests now mix one and two colons in CSS, but the user agent stylesheet
and internal representation of the pseudo-elements now awlays use two
colons.
Create first-letter box after white space handling
As ::first-letter depends on white space handling, we must create the
box after collapsing spaces, not during the build of the box tree.

This commit makes WeasyPrint pass most of the W3C tests related to
first-letter (and never crash). Known problems left include:

- list markers are considered as the first letter,
- lines may break between the first letter and the rest of the text
  (see #163 and #301),
- the CSS attributes are all kept, some should probably be removed (the
  spec doesn't give a whole list).

Even if W3C tests makes me quite confident (some of them are crazy),
tests must be added in WeasyPrint too.

@liZe liZe added the feature label Jan 2, 2017

@liZe liZe self-assigned this Jan 2, 2017

@liZe liZe merged commit d6ab8ff into master Feb 16, 2017

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

@liZe liZe deleted the first branch Feb 16, 2017

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Mar 3, 2017

kleink
Update py-weasyprint to 0.36.
Version 0.36
------------

Released on 2017-02-25.

New features:

* `#407 <Kozea/WeasyPrint#407>`_:
  Handle ::first-letter.
* `#423 <Kozea/WeasyPrint#423>`_:
  Warn user about broken cairo versions.

Bug fixes:

* `#411 <Kozea/WeasyPrint#411>`_:
  Typos fixed in command-line help.


Version 0.35
------------

Released on 2017-02-25.

Bug fixes:

* `#410 <Kozea/WeasyPrint#410>`_:
  Fix AssertionError in split_text_box.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment