Guillaume Ayoub
328de5e67e
Merge pull request #907 from makeleaps/nowrap
...
Refactor LayoutContext building
2019-07-23 18:01:56 +02:00
Raphael Gaschignard
afc7dabc1b
Refactor LayoutContext building
...
this will provide a simpler API for testing context-using functions inside tests
2019-07-23 14:12:08 +09:00
grewn0uille
135dc06c9a
Handle recto/verso on page break.
2019-07-18 14:34:45 +02:00
Guillaume Ayoub
fc7db276e5
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.
2019-04-02 12:39:00 +02:00
Guillaume Ayoub
3e953b457e
Simplify page style declaration
2019-04-02 12:00:47 +02:00
Guillaume Ayoub
ed4f00848f
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.
2019-04-02 11:19:48 +02:00
Guillaume Ayoub
f2e9784ee7
Add a stupid and broken support of nth page selector
2019-04-01 18:45:59 +02:00
Guillaume Ayoub
f1a6da72ac
Set set_computed_styles as a StyleFor method
2019-04-01 15:24:18 +02:00
Guillaume Ayoub
84e1813c6c
Merge branch 'master' into media-queries
2019-04-01 14:41:51 +02:00
Guillaume Ayoub
75d8d983ae
Handle margin-break
...
Some corner-cases are not handled yet, but that's much better than the current
situation.
Fix #115 .
2019-03-18 18:13:43 +01:00
Guillaume Ayoub
167ebce065
Please isort again
2019-03-10 19:34:16 +01:00
Guillaume Ayoub
b7a9fe7dcc
Update copyright
2019-03-04 11:04:06 +01:00
Guillaume Ayoub
0cc5478252
Fix imports for isort
2019-03-01 11:38:03 +01:00
Tontyna
486f8df573
Prevent endless loop and index out of range in pagination
2019-02-10 21:32:28 +01:00
Guillaume Ayoub
92a0d5ffec
Follow the famous nonexistent guide of style
2019-02-05 13:50:45 +01:00
Tontyna
b041a0600f
Resolve pending backward targeted references
2019-02-05 13:24:16 +01:00
Tontyna
cfc16c66af
Fix remnant TargetCollecor.items
2019-02-05 13:09:47 +01:00
Guillaume Ayoub
857d889816
Merge branch 'master' into media-queries
2019-01-24 18:36:53 +01:00
Guillaume Ayoub
3513e95b41
Use a separate logger for generation progress
2019-01-03 23:02:44 +01:00
Guillaume Ayoub
8b7f529064
Add missing spaces
2018-10-11 13:03:47 +02:00
Guillaume Ayoub
56904baa79
Use the same copyright line everywhere
2018-09-20 18:46:27 +02:00
Guillaume Ayoub
4a6153fa7d
Put media queries in a separate module, create a class for style_for
2018-08-17 10:30:51 +02:00
Guillaume Ayoub
65240c6f78
Clean comments and variable names
2018-08-08 17:49:03 +02:00
Guillaume Ayoub
b905d89169
Clean a lot of little things
2018-08-07 15:26:18 +02:00
Tontyna
d9ecb73afd
Optimize repagination
2018-07-29 14:41:21 +02:00
Tontyna
41d51ca67b
Introduce page_maker to control pagination
2018-07-08 11:43:51 +02:00
Tontyna
fdf50eb14e
Collect context.string_set when pagination is finished
2018-07-02 19:37:02 +02:00
Tontyna
c49538bf8e
Fill in missing page based counters during pagination
2018-06-30 14:48:57 +02:00
Tontyna
983d7f3081
Correct selector for matching PageType
2018-06-20 20:26:14 +02:00
Guillaume Ayoub
cf06c7d4e8
Clean little things
2018-05-26 00:22:32 +02:00
Tontyna
e56ffb9031
Enable counter-increment and -reset in page context
2018-05-18 16:31:38 +02:00
Guillaume Ayoub
2be9959525
Clean many things about properties validation and computed values
2018-04-14 13:44:10 +02:00
Guillaume Ayoub
07865f6371
Don't use a global target collector
2018-03-28 00:34:34 +02:00
Guillaume Ayoub
19365e824e
Fix all crashes with W3C test suite
2018-02-24 04:41:11 +01:00
Guillaume Ayoub
2ef988ca20
Fix string-set logic
2018-01-23 01:55:16 +01:00
Guillaume Ayoub
16e8186568
Drop Python 2 support
2018-01-14 01:48:17 +01:00
Guillaume Ayoub
ad11edfff2
Remove StyleDict objects
2018-01-13 17:41:08 +01:00
Guillaume Ayoub
724565f27a
Don't allow attribute access to StyleDict objects
2018-01-13 17:05:23 +01:00
Guillaume Ayoub
5085a704b7
Fix mixed break and page properties
2017-08-05 15:27:03 +02:00
Guillaume Ayoub
508b365a05
Give the page name when creating PageTypes
2017-08-04 14:14:25 +02:00
Guillaume Ayoub
63f687f70b
Include the page name in the next_page variable
2017-08-04 13:49:40 +02:00
Guillaume Ayoub
84dd9b8002
Merge branch 'master' into namedpages
2017-08-02 23:52:17 +02:00
Guillaume Ayoub
84bdee14c3
Revert "Change table and table-* elements' style before creating StyleDicts"
...
This reverts commit ca8bc3e578
.
The main change is the creation of StyleDicts removed from style_for, for
memory consumption problems.
2017-08-02 20:21:34 +02:00
Guillaume Ayoub
7d0add7b91
Allow updated values in style_for
2017-08-01 09:53:30 +02:00
Guillaume Ayoub
b3865c811c
Re-add a copy method for StyleDict
2017-07-28 22:28:29 +02:00
Guillaume Ayoub
a3e2c474f0
Transform StyleDict into a kind of frozen dict
...
This forces to use a copy when changes are needed. Internal mutable structures
have also been changed into immutable ones (i.e. lists have been turned into
tuples).
This change is a really useful first step to greatly optimize memory and time
needed to render large documents, as allows us to cache style dicts more
safely. It's been already done in StyleDict.inherit_from, with a ~5-10% memory
benefice.
2017-07-28 13:35:06 +02:00
Guillaume Ayoub
f856edb3b4
Log the document generation steps
...
Related to #488 .
2017-07-25 13:58:18 +02:00
Guillaume Ayoub
344cb08f60
Don't copy styles when copying boxes, improve memory management
...
Style is not copied anymore when boxes are duplicated. Style dicts are not
modified anymore during the layout, as it was before for some properties:
- margins, borders and paddings when the box was split between two
pages (useless as these computed values are stored directly in the box),
- top borders were changed in tables (useless for the same reason),
- bookmark labels and string sets are now stored in the box.
This commit can introduce very subtle bugs that are hard to debug. In the
future, we should try to freeze the style dicts before the layout.
Related to #70 .
2017-07-22 13:51:03 +02:00
Guillaume Ayoub
fb40d56b4a
Remove the all_names attribute of matching_page_types
2017-07-18 12:02:30 +02:00
Guillaume Ayoub
30e4098b40
Set the page styles lazily
2017-07-17 23:40:59 +02:00