1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 08:27:22 +03:00
Commit Graph

152 Commits

Author SHA1 Message Date
Guillaume Ayoub
0ac600234c Make named pages inherit from anonymous page style 2017-08-07 12:21:17 +02:00
Guillaume Ayoub
515d85f1d7 Basic support of named pages
Fix #57.
2017-08-04 23:04:30 +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
c779977271 Unfreeze StyleDict 2017-08-02 16:32:37 +02:00
Guillaume Ayoub
7d0add7b91 Allow updated values in style_for 2017-08-01 09:53:30 +02:00
Guillaume Ayoub
6ed7e59aa9 Hide StyleDict.update 2017-08-01 09:53:10 +02:00
Guillaume Ayoub
ca8bc3e578 Change table and table-* elements' style before creating StyleDicts 2017-07-31 13:48:58 +02:00
Guillaume Ayoub
39fe17dc95 Don't copy StyleDicts when there's no need to 2017-07-31 11:28:23 +02:00
Guillaume Ayoub
7abfcb9e75 Update StyleDict.copy's description 2017-07-30 14:00:33 +02:00
Guillaume Ayoub
b3865c811c Re-add a copy method for StyleDict 2017-07-28 22:28:29 +02:00
Guillaume Ayoub
56f27885f4 Remove StyleDict mutations and copies 2017-07-28 19:56:14 +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
fcd6bf7070 Clean and document the logging levels
Related to #488.
2017-07-25 13:59:56 +02:00
Guillaume Ayoub
f856edb3b4 Log the document generation steps
Related to #488.
2017-07-25 13:58:18 +02:00
Guillaume Ayoub
fb40d56b4a Remove the all_names attribute of matching_page_types 2017-07-18 12:02:30 +02:00
Guillaume Ayoub
cb45253bc9 Fix computed value of 'page' attribute 2017-07-18 12:01:50 +02:00
Guillaume Ayoub
9270697e80 Handle the page property 2017-07-18 02:01:36 +02:00
Guillaume Ayoub
30e4098b40 Set the page styles lazily 2017-07-17 23:40:59 +02:00
Guillaume Ayoub
c004dc47d1 Use a custom object instead of constants for page pseudo-classes
This is a first step to lazily get the page styles and support named pages.
2017-07-17 22:48:21 +02:00
Guillaume Ayoub
e0acecb4db Reorder imports 2017-07-13 17:39:29 +02:00
Guillaume Ayoub
718e4c3d8a Remove debug print 2017-07-13 17:38:12 +02:00
Guillaume Ayoub
a0dba07b67 Don't store base_url in ElementWrappers 2017-07-07 11:14:07 +02:00
Guillaume Ayoub
ba26fa34a9 Use ElementTree's elements as much as possible 2017-07-03 15:19:05 +02:00
Guillaume Ayoub
9468957a23 Flatten stylesheets list 2017-07-01 07:41:13 +02:00
Guillaume Ayoub
42552e2069 Don't go through the tree twice when applying styles 2017-07-01 07:26:36 +02:00
Guillaume Ayoub
0f6647194b Get rid of lxml 2017-06-30 22:48:47 +02:00
Guillaume Ayoub
f349f8b276 Make HTML inherit from cssselect2.ElementWrapper 2017-06-30 20:12:53 +02:00
Guillaume Ayoub
4a5fa84f9f Use cssselect2 instead of cssselect 2017-06-30 17:54:02 +02:00
Guillaume Ayoub
98ae8c7f95 Merge pull request #445 from Kozea/tinycss2
Switch to tinycss2
2017-04-01 19:04:08 +02:00
Tarashish Mishra
0fa6838c77 Let the logging module do the string interpolation 2017-03-28 13:02:50 +05:30
Simon Sapin
0aa62e249e Switch to tinycss2 2017-03-26 18:44:21 +02:00
Guillaume Ayoub
1215cb586a Allow relative URIs in anchors
Fix #437.

Backward-incompatible change: the signature of weasyprint.urls.url_join has
changed to allow relative links without a base URI.

This feature doesn't look really safe at first sight, but I can't find
anything bad coming from these changes. If there's a bug, I take the blame.
2017-03-25 18:28:41 +01:00
Keith Callenberg
0463f0d919 check for font_config
check for font_config before attempting to add_font_face
2016-11-17 15:29:39 -05:00
Guillaume Ayoub
ac0fdf962f Support simple table[cellpadding] 2016-11-17 01:06:10 +01:00
Guillaume Ayoub
6048545413 Support ol[start] and ul[value] 2016-11-17 00:37:03 +01:00
Guillaume Ayoub
d37b3a01cc Apply presentational hints before stylesheets 2016-11-10 19:15:35 +01:00
Guillaume Ayoub
72022e421d Merge remote-tracking branch 'origin/master' into perf 2016-11-03 12:55:14 +01:00
Guillaume Ayoub
9abc034773 Change StyleDict into a real dict
This commit has a really good impact on speed (+15~30%) but a really bad
impact on memory usage (+30~40%).
2016-11-01 02:32:06 +01:00
Guillaume Ayoub
7f832f57e8 Add font_config parameter when loading CSS in CSS 2016-10-28 17:44:31 +02:00
Guillaume Ayoub
152193cf77 Add the font configuration in LayoutContext
The font configuration is available (almost) everywhere it's needed,
@font-face doesn't rely on a global state anymore.
2016-10-27 17:36:24 +02:00
Guillaume Ayoub
d7b89dbb68 Clean the font config after rendering the document 2016-10-27 11:41:34 +02:00
Guillaume Ayoub
b5103d349f Create a new font config for each document 2016-10-26 17:17:00 +02:00
Guillaume Ayoub
b54233c8bf Use the default url fetcher to fetch fonts 2016-10-07 13:54:12 +02:00
Guillaume Ayoub
dfbe409ae0 WIP: Support @font-face 2016-09-26 12:15:12 +02:00
Guillaume Ayoub
140275ad1d Split rules and descriptors in CSS 2016-09-24 15:36:26 +02:00
Guillaume Ayoub
49cff975a1 Parse @font-face rules 2016-09-23 19:00:14 +02:00
Guillaume Ayoub
7925baa5f8 Test presentational hints 2016-09-01 02:11:33 +02:00
Guillaume Ayoub
207694ac14 Use a stylesheet for some presentational hints 2016-08-31 22:33:26 +02:00
Guillaume Ayoub
8810f82841 Add an option to follow presentational hints 2016-08-30 19:10:53 +02:00
Guillaume Ayoub
b2a5d7a98f Add a presentational-hints option 2016-08-30 18:15:30 +02:00
Guillaume Ayoub
43ded770c7 Flake8 forever <3 <3 2016-08-29 17:59:28 +02:00
Guillaume Ayoub
49f7a4acec Support presentational hints 2016-08-29 17:50:07 +02:00
Guillaume Ayoub
e285acda8e Draw column rules 2016-08-15 03:34:40 +02:00
Guillaume Ayoub
33aa5c6f6b Initial support of multi-column layouts
Related to #60.

This commit adds a really simple support of multi-column layouts.
2016-08-14 23:12:30 +02:00
Guillaume Ayoub
07e15db142 Add 'rem' support
This feature is kindly provided to you by Florian Demmer!
2016-02-11 23:02:53 +01:00
Alex Eftimie
93f497bf11 Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
Simon Sapin
43d1e73e65 Fix code formatting. (Clean flake8!) 2014-04-27 12:29:55 +01:00
Simon Sapin
e65b26f38b Fix parsing of <link rel> 2014-04-22 01:34:47 +01:00
Simon Sapin
c34221d215 2014. 2014-01-10 14:27:02 +00:00
Florian Mounier
e3d7bad55b Be careful logging.warn is deprecated 2013-08-19 14:38:09 +02:00
Simon Sapin
eb08733938 Add PDF metadata parsed from HTML. Fix #77.
<title> → /Title
<meta name=author> → /Author
<meta name=description> → /Subject
<meta name=keywords> → /Keywords
<meta name=generator> → /Creator
<meta name=dcterms.created> → /CreationDate
<meta name=dcterms.modified> → /ModDate
"WeasyPrint vX.Y" → /Producer
2013-07-22 00:13:11 +01:00
Simon Sapin
3313c061ae Fix #84: Mak loading an author stylesheet not fatal. 2013-06-20 22:11:19 +01:00
Simon Sapin
711d5aa19b Small refactoring. 2013-06-20 12:40:21 +01:00
Simon Sapin
1d1bf9cdc9 Flake8. 2013-04-11 12:08:53 +02:00
Guillaume Ayoub
a79a8f83a5 Don't crash when control characters are in CSS selectors 2013-04-08 17:40:19 +02:00
Simon Sapin
171438f48e 2013 2013-04-03 16:23:48 +02:00
Simon Sapin
829c758788 Keep currentColor as a computed value, resolve in used value
According to the css3-color errata:
http://www.w3.org/Style/2011/REC-css3-color-20110607-errata.html
2013-01-23 16:52:47 +01:00
Simon Sapin
6f56613441 Do not require HtmlElement.
* Do not use element.base_url which only exists in lxml.html.HtmlElement
* Use lxml.etree.HtmlParser instead of lxml.html

This is one step toward using the html5lib parser, but see
https://github.com/Kozea/WeasyPrint/pull/12
2012-11-06 13:55:39 +01:00
Simon Sapin
ba987f0daf Remove out-dated parts of the weasyprint.css docstring. 2012-10-09 17:10:45 +02:00
Simon Sapin
f33c91742d Get rid of the Document class (finally!) 2012-09-25 16:37:18 +02:00
Simon Sapin
7984fbd3bc Warn (not crash) on missing base_url for @import 2012-09-25 16:01:12 +02:00
Guillaume Ayoub
50210b266f Add support for @page:blank pseudo-class 2012-08-24 00:05:28 +02:00
Simon Sapin
ba8a55d5c0 Add support for outlines. 2012-08-03 16:22:32 +02:00
Simon Sapin
ec8cbc6c24 Remove one-line methods in Document. 2012-08-03 11:51:58 +02:00
Simon Sapin
1864d3365a s/medium/media_type/ s/user_agent_stylesheets/ua_stylesheets/ 2012-08-02 13:04:31 +02:00
Chung Wu
a51562149c Can specify the @media medium to use (defaults to print) 2012-08-01 19:09:48 -07:00
Simon Sapin
5a779f49dc Fix relative stylesheet URL without a base URL.
Previously we passed url=None to CSS which failed with
a "zero source" exception.
2012-07-17 15:23:58 +02:00
Simon Sapin
a0cf7c7617 Test url_fetcher, make it work on stylesheets 2012-07-13 13:21:59 +02:00
Simon Sapin
d038708b8b Kill Document in css/__init__.py 2012-07-12 15:21:37 +02:00
Simon Sapin
a83ff7b0ee Fix #772: Use redirected URLs as base URLs 2012-06-14 22:08:34 +02:00
Simon Sapin
d694a98350 Rename the utils module to 'urls' 2012-05-23 15:13:57 +02:00
Guillaume Ayoub
9ea53bf466 Add initial support of external hyperlinks 2012-05-14 18:31:51 +02:00
Simon Sapin
0a164aa1fc Use the new cssselect. 2012-04-27 10:58:15 +02:00
Simon Sapin
f6b202fa5f tinycss changes + a few more tests 2012-04-05 16:31:32 +02:00
Simon Sapin
73b0bd6281 Disallow _ instead of - in property names. 2012-04-04 15:07:39 +02:00
Simon Sapin
46b1d225c7 Tests n’ fixes. Lots of them. 2012-04-03 11:34:29 +02:00
Simon Sapin
ad3cdf5dae tinycss again 2012-03-31 18:22:55 +02:00
Simon Sapin
fb37336f7a Catch up with tinycss changes. 2012-03-28 18:42:47 +02:00
Simon Sapin
1446fccb33 Also pre-proccess @import and @media 2012-03-25 01:41:02 +01:00
Simon Sapin
52b6124e2e Pre-process stylesheet (do validation just after parsing) 2012-03-25 00:39:41 +01:00
Simon Sapin
b78f939ee7 Remove remaining references to cssutils. 2012-03-24 22:10:38 +01:00
Simon Sapin
96feb96574 Switch from cssutils to tinycss as the CSS parser 2012-03-24 21:32:15 +01:00
Simon Sapin
dcacf9eed0 Switch the licence to BSD and rewrite module docstrings/headers 2012-03-21 23:26:58 +01:00
Simon Sapin
26de362b99 Add proper attribution in AUTHORS 2012-03-21 18:40:38 +01:00
Simon Sapin
9875f76995 Hello 2012 2012-03-21 18:40:38 +01:00
Guillaume Ayoub
016befd1af Handle the combined selectors with pseudo-elements 2012-02-27 17:55:27 +01:00
Simon Sapin
7ad1083e88 Rename weasyprint.logging to avoid conflicts the stdlib module. 2012-02-23 19:31:15 +01:00
Simon Sapin
0ef3b35e90 Actual python 2.6 compatibility 2012-02-21 14:13:34 +01:00
Simon Sapin
ff135aa285 Python 3 compat. All tests pass with the same code base! 2012-02-17 22:48:20 +01:00