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

396 Commits

Author SHA1 Message Date
Simon Sapin
d974d410b7 Fix URL quoting on Python 2.6 2012-05-18 17:54:10 +02:00
Simon Sapin
c828f3835d Avoid using OrderedDict (for Python 2.6). 2012-05-18 17:18:58 +02:00
Simon Sapin
383f7b642b PDF: use a line iterator instead of .pop(0) 2012-05-18 16:31:39 +02:00
Guillaume Ayoub
525f1030c5 Useless typo 2012-05-18 16:23:08 +02:00
Guillaume Ayoub
9211fa570d Remove borders around links 2012-05-18 16:08:18 +02:00
Guillaume Ayoub
bfeb102c98 Test bookmarks 2012-05-18 15:38:57 +02:00
Simon Sapin
8c3f16fc8c Fix URI encoding per RFC 3986 and 3987. 2012-05-18 09:13:09 +02:00
Guillaume Ayoub
64cb7b4104 Handle the bookmarks as a tree 2012-05-17 22:46:03 +02:00
Guillaume Ayoub
111932edf5 Add first-level bookmarks, use floats for XY positions, fix little things 2012-05-15 19:29:54 +02:00
Simon Sapin
1ea79c9e9e Fix importing urllib.quote on Py 2.x 2012-05-15 18:16:25 +02:00
Simon Sapin
1ff949b888 Have the PDF post-process run on Python3 (links are broken) 2012-05-15 13:40:36 +02:00
Guillaume Ayoub
76c15235e6 Replace the PDF class by a function 2012-05-15 03:29:57 +02:00
Guillaume Ayoub
488a6a99c9 Remove the "active" attribute 2012-05-15 01:56:19 +02:00
Guillaume Ayoub
ff8d50ce3e Remove a useless attribute 2012-05-15 01:28:09 +02:00
Guillaume Ayoub
65a286f12f Stupid typo 2012-05-15 01:16:39 +02:00
Guillaume Ayoub
bb2727417f Write the PDF without the second iteration on initial lines 2012-05-15 01:15:07 +02:00
Guillaume Ayoub
34c12fe3ef Remove a useless continue 2012-05-15 00:32:19 +02:00
Guillaume Ayoub
b38ce4f0a3 Clean again the pdf module 2012-05-15 00:30:20 +02:00
Guillaume Ayoub
6848846b8e Add a docstring 2012-05-14 23:59:24 +02:00
Guillaume Ayoub
802a7351d8 Clean and document the pdf module 2012-05-14 23:58:18 +02:00
Guillaume Ayoub
42f2cf4e0e Display correctly unknown links 2012-05-14 23:34:07 +02:00
Guillaume Ayoub
da08226ccd Use bytes in the whole pdf module 2012-05-14 23:24:27 +02:00
Guillaume Ayoub
ba75a84e95 Don't add another sharp for inner links 2012-05-14 23:18:20 +02:00
Guillaume Ayoub
22635c0c71 Initial support of internal links 2012-05-14 19:40:38 +02:00
Guillaume Ayoub
9ea53bf466 Add initial support of external hyperlinks 2012-05-14 18:31:51 +02:00
Simon Sapin
1bfdce6b8c Do not crash on letter-spacing: normal 2012-05-14 11:57:55 +02:00
Simon Sapin
0c80b77f31 Handle absolute tables 2012-05-14 08:15:52 +02:00
Simon Sapin
bf95751558 Fix outside list marker position on absolute list-items. 2012-05-11 20:50:28 +02:00
Simon Sapin
ea18e88fdc Crash fix: skip absolute boxes that are not laid out yet in various places. 2012-05-11 20:39:56 +02:00
Guillaume Ayoub
15790dc51e Handle inline absolute elements 2012-05-11 19:31:31 +02:00
Guillaume Ayoub
f795cccb58 Don't display the "option" elements 2012-05-11 16:20:14 +02:00
Guillaume Ayoub
b3a91e4e26 Fix the width repartition between columns when sum(preferred_widths) = 0 2012-05-11 16:17:23 +02:00
Guillaume Ayoub
f1da53a32a Fix the z-index 2012-05-11 16:07:14 +02:00
Guillaume Ayoub
475a924e89 Fix the stacking contexts 2012-05-11 14:10:11 +02:00
Simon Sapin
2b7bb4108e Special treatement for page boxes in StackingContext 2012-05-11 10:49:52 +02:00
Simon Sapin
10627f6f6d Sort stacking contexts by z-index. 2012-05-11 10:27:48 +02:00
Guillaume Ayoub
632f57dff5 Fix angles in transform 2012-05-10 22:10:29 +02:00
Guillaume Ayoub
e963367e98 Typos 2012-05-10 22:09:04 +02:00
Guillaume Ayoub
3f4113fa5f Add a StackingContext in preparation for z-index drawing. 2012-05-10 20:57:29 +02:00
Guillaume Ayoub
8d1b86c40f Layout in place absolute boxes 2012-05-10 20:12:47 +02:00
Guillaume Ayoub
7eb3ba187e Add tests for absolute boxes 2012-05-10 16:10:04 +02:00
Guillaume Ayoub
b20022ee11 Fix some little things about absolute blocks 2012-05-10 13:56:21 +02:00
Guillaume Ayoub
1fc2da2a5c Add initial support of position: absolute, missing z-index 2012-05-10 05:57:06 +02:00
Guillaume Ayoub
2ea63210bf Add a list of absolute elements 2012-05-09 19:01:32 +02:00
Guillaume Ayoub
994e6a933a Handle not-in-flow elements in inline boxes 2012-05-09 17:08:23 +02:00
Guillaume Ayoub
d9056d9a4f Remove a useless monkey patch in tests about inline blocks 2012-05-09 17:08:23 +02:00
Guillaume Ayoub
369faf4d7b Fix relative positioning for inline boxes 2012-05-09 17:07:01 +02:00
Guillaume Ayoub
fcf7d1ff2c Add untested support of relative 2012-05-09 13:15:13 +02:00
Guillaume Ayoub
449ca2db07 Remove useless space 2012-05-08 03:40:27 +02:00
Simon Sapin
e1040a8d66 Next is 0.9 2012-05-07 18:32:07 +02:00
Simon Sapin
2435e50a48 Tag v0.8 2012-05-07 18:31:33 +02:00
Guillaume Ayoub
f1ebf59486 Add some tests and fixes about auto layout tables 2012-05-07 18:16:32 +02:00
Simon Sapin
aef93f27dc Fix text-related tests (changed on a PyGobject upgrade???) 2012-05-04 17:05:47 +02:00
Simon Sapin
0671b499dd Repeat table headers and footers on every page. 2012-05-04 17:05:16 +02:00
Simon Sapin
0a164aa1fc Use the new cssselect. 2012-04-27 10:58:15 +02:00
Guillaume Ayoub
7b3c17f9db Add tests for static layout of tables 2012-04-16 13:50:19 +02:00
Guillaume Ayoub
efa01839e6 Avoid a division by 0 in static layout for tables 2012-04-16 13:48:46 +02:00
Simon Sapin
8bb2d566c2 Oooops 2012-04-12 17:20:58 +02:00
Simon Sapin
074e8884c8 Implement inline tables. 2012-04-12 17:20:57 +02:00
Simon Sapin
9d4e5b9d6f Simplify table wrapper layout. 2012-04-12 17:20:57 +02:00
Simon Sapin
78b86f400e Only use the fixed table layout with a non-auto width.
As specified, fall back to the automatic layout when the
computed width is 'auto'.

This will enable some code simplifications, and prepare
for inline tables.
2012-04-12 17:20:57 +02:00
Guillaume Ayoub
9af417088f Small fix for preferred width of tables 2012-04-12 13:20:41 +02:00
Guillaume Ayoub
ccb73421f8 Fix the `adjust` function for tables 2012-04-10 19:00:56 +02:00
Guillaume Ayoub
c2a6a70736 Fix the preferred width resolution of the tables 2012-04-10 18:29:00 +02:00
Guillaume Ayoub
643eb9a957 Handle the captions 2012-04-10 17:56:23 +02:00
Guillaume Ayoub
e349cf5b5b Typo 2012-04-10 16:08:53 +02:00
Guillaume Ayoub
130132b1a0 Merge branch 'master' of github.com:Kozea/WeasyPrint 2012-04-10 16:07:46 +02:00
Simon Sapin
caab31ccff The baseline for table cells and inline blocks is really not the same thing. 2012-04-10 16:07:32 +02:00
Guillaume Ayoub
8d9ce51fbd Merge branch 'master' of github.com:Kozea/WeasyPrint 2012-04-10 15:51:48 +02:00
Simon Sapin
fe52a7b0f6 Fix baseline for table rows. 2012-04-10 15:46:36 +02:00
Guillaume Ayoub
918828be3e Merge branch 'master' of github.com:Kozea/WeasyPrint 2012-04-10 15:07:43 +02:00
Simon Sapin
3c9512bd77 Bug fix for inline block baseline. 2012-04-10 15:07:10 +02:00
Guillaume Ayoub
3a86c1e679 Add the functions for preferred sizes of tables 2012-04-10 14:38:18 +02:00
Simon Sapin
4a146224c0 Proper vertical-align for inline blocks. 2012-04-10 12:50:22 +02:00
Guillaume Ayoub
1a08117491 Fix again the TODO 2012-04-10 12:31:43 +02:00
Guillaume Ayoub
110c4be520 Update a TODO about auto layout for tables 2012-04-10 12:30:25 +02:00
Simon Sapin
3ead78fe7d Account for {min,max}-width for preferred widths. 2012-04-10 12:00:31 +02:00
Simon Sapin
12b856c79e Add min-width/max-width for inline blocks. 2012-04-10 11:43:59 +02:00
Simon Sapin
0e66f6a72f Merge branch 'shrinktofit' 2012-04-10 11:11:57 +02:00
Guillaume Ayoub
0352572cc8 Remove prints and add a TODO about point #4 of tables auto layout 2012-04-07 15:12:17 +02:00
Guillaume Ayoub
b6e7998a73 Handle point #4 of table auto layout 2012-04-07 15:04:48 +02:00
Guillaume Ayoub
0d59b2600f Clean and fix a lot of things in tables auto layout 2012-04-07 14:25:30 +02:00
Simon Sapin
7ac982a01c Implement {min,max}-{width,height} on images. 2012-04-06 19:44:09 +02:00
Simon Sapin
27245aa915 Assume intrinsic dimensions for replaced elements. 2012-04-06 17:01:33 +02:00
Simon Sapin
79675f58b0 Implement min-height and max-height on blocks 2012-04-06 16:42:06 +02:00
Simon Sapin
cde28023d6 Implement min-width and max-width on blocks. 2012-04-06 16:19:16 +02:00
Simon Sapin
9ff7b99b30 Fix box-sizing 2012-04-06 15:56:36 +02:00
Simon Sapin
e420cb002b Allow percentage paddings 2012-04-06 15:43:05 +02:00
Guillaume Ayoub
4593b51c75 Merge branch 'master' into shrinktofit 2012-04-05 20:15:52 +02:00
Guillaume Ayoub
af7605cce8 Fix the test for tinycss warnings 2012-04-05 20:15:28 +02:00
Guillaume Ayoub
1f2895baaa Merge branch 'shrinktofit' of github.com:Kozea/WeasyPrint into shrinktofit 2012-04-05 20:08:02 +02:00
Guillaume Ayoub
7411e1b66d Check percentages in the inline-block test 2012-04-05 20:07:29 +02:00
Simon Sapin
fd162e2825 Merge branch 'master' into shrinktofit 2012-04-05 16:32:36 +02:00
Simon Sapin
f6b202fa5f tinycss changes + a few more tests 2012-04-05 16:31:32 +02:00
Simon Sapin
b113b29fd7 Update shrink-to-fit for tinycss. 2012-04-05 13:16:17 +02:00
Simon Sapin
61bf188290 Merge branch 'master' into shrinktofit
Conflicts:
	weasyprint/layout/blocks.py
	weasyprint/layout/inlines.py
2012-04-05 12:38:42 +02:00
Guillaume Ayoub
8e2603acaf Add two more asserts in the inline-block tests 2012-04-05 12:31:51 +02:00
Simon Sapin
34612cc4fb Simplify the handling of 'auto' lengths. 2012-04-05 11:21:26 +02:00
Simon Sapin
73b0bd6281 Disallow _ instead of - in property names. 2012-04-04 15:07:39 +02:00
Guillaume Ayoub
21277c18cc Add some tests, split inner/outer preferred widths 2012-04-04 14:25:13 +02:00
Simon Sapin
1ba5b32e7b Tests and fixes for drawing 2012-04-04 13:58:06 +02:00
Simon Sapin
1633fec47c Add some tests for validation. 2012-04-03 19:37:13 +02:00
Guillaume Ayoub
58fb02dcbb Don't collapse spaces across atomic inline blocks 2012-04-03 18:58:55 +02:00
Simon Sapin
8ac2b63827 Clean up shorthand properties tests. 2012-04-03 17:12:51 +02:00
Simon Sapin
88c027117c Do not keep tokens for percentages after validation.
Make (value, unit) namedtuples instead.
Pixel values that could be percentages are not plain numbers anymore.
2012-04-03 16:12:25 +02:00
Simon Sapin
d785f4e46d Rename value(s) to token(s) in validation. 2012-04-03 12:45:29 +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
002284affb Simplify text tests 2012-03-25 00:45:52 +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
Guillaume Ayoub
42e25e1e3c Add a basic shrink to fit for tables 2012-03-23 19:31:54 +01:00
Guillaume Ayoub
82db8a421c Fix the shirk to fit agorithm 2012-03-23 17:33:59 +01:00
Guillaume Ayoub
e8920cea3f Don't shrink inline-blocks with multiple lines 2012-03-23 13:32:44 +01:00
Guillaume Ayoub
67e6cc5063 Include the margin/border/padding when translating inline-block boxes 2012-03-23 01:16:08 +01:00
Guillaume Ayoub
0c891965d2 Resolve margin_width when possible for preferred values
This fix sets the margin/border/padding values for inline-block children
2012-03-23 01:04:38 +01:00
Guillaume Ayoub
48c7005019 Fix the x and y position of the children of the inline-block boxes 2012-03-23 00:45:38 +01:00
Guillaume Ayoub
b5d1c3f7de Handle fixed sizes in inline-block children 2012-03-22 23:52:32 +01:00
Guillaume Ayoub
65a8d64490 Fix the maximum preferred width when a maximum width is set 2012-03-22 23:41:24 +01:00
Guillaume Ayoub
abd386796f Naive implementation of inline-block evelements 2012-03-22 23:26:09 +01:00
Guillaume Ayoub
2c0c83693f Add the function definitions for shrink to fit 2012-03-22 19:32:59 +01:00
Simon Sapin
ccdfbe1d97 Boilerplate for inline-block support 2012-03-22 18:36:56 +01:00
Simon Sapin
58f3d2a1ac Merge branch 'v0.7.x' 2012-03-21 23:27:38 +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
e40067102c Next is 0.8 2012-03-21 19:03:05 +01:00
Simon Sapin
d7843b2231 Tag v0.7 2012-03-21 19:01:28 +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
Simon Sapin
7172323b8f Add page-break-inside: avoid on table row groups 2012-03-21 18:36:03 +01:00
Simon Sapin
fc4d091f82 Add page-break-inside: avoid for tables 2012-03-21 18:09:03 +01:00
Simon Sapin
f2db08b310 Fix and test page breaks inside tables
rowspan > 1 is not handled correctly, but having *some* page breaks
is more valuable
2012-03-21 18:01:24 +01:00
Simon Sapin
e23c38bfd2 Merge branch 'master' into table-breaks
Conflicts:
	weasyprint/css/validation.py
2012-03-21 17:06:47 +01:00
Simon Sapin
c521322ee7 Fix base64 URLs without padding 2012-03-21 16:07:49 +01:00
Simon Sapin
f46e01fddd Simplify error handling in images.
Catch any non-sytem exception and consider that as an invalid image.

This may hide bugs, maintaining a growing list of invalid-image
exceptions was no fun either. The exception’s repr() is logged as usual.
2012-03-21 14:34:27 +01:00
Simon Sapin
5dda72d932 Add a test for the redundant shorthand fix. 2012-03-21 14:03:58 +01:00
Simon Sapin
232491662f Ignore declarations on redundant values in shorthands.
(We previously just crashed with an AssertError.)
2012-03-21 13:57:33 +01:00
Simon Sapin
f814dc0243 Add page-break-inside: avoid 2012-03-21 11:36:24 +01:00
Priit Laes
f4a143a642 table-break: Fix infinite loop in case table row > page height 2012-03-17 13:43:19 +02:00
Priit Laes
3e2eb91341 table-break: WIP page-breaks inside tables 2012-03-16 21:09:24 +02:00
Priit Laes
b29ada1515 Fix typo in CSS validator 2012-03-16 17:03:03 +02:00
Simon Sapin
248e843a40 Port fireweasy to the new API 2012-03-15 20:00:23 +01:00
Simon Sapin
e07030fb61 Port the test web app to the new API 2012-03-15 19:53:31 +01:00
Simon Sapin
1d6c94828e Add support for orphans and widows. 2012-03-14 19:33:24 +01:00
Simon Sapin
3632842b16 Better forced page breaks
If eg. page-break-before is 'always' on a first child, the break is
between the clostest ancestor that has a previous sibling and
that sibling.

See the changed test for an example.
2012-03-14 16:26:20 +01:00
Simon Sapin
869aac58c7 Ignore display: table-* values for inline elements
They end up as inline-level replaced boxes.
2012-03-14 13:34:08 +01:00
Simon Sapin
ae3c73db68 Use a bit more the cairo API. 2012-03-07 14:02:07 +01:00
Simon Sapin
45f7751600 Next is 0.7 2012-02-29 20:47:10 +01:00
Simon Sapin
8466ffe065 Tag v0.6 2012-02-29 20:41:48 +01:00
Simon Sapin
5c888817cf Add missing test images. 2012-02-29 20:20:32 +01:00
Simon Sapin
90d8bd459f Normalize case for --format Pdf 2012-02-29 20:17:44 +01:00
Simon Sapin
476732b81c Support images in <embed> or <object> 2012-02-29 17:38:30 +01:00
Simon Sapin
e6cee2f2ab Put block-level images on the next page when they would overflow. 2012-02-29 12:23:25 +01:00
Simon Sapin
3a4cf78c94 More tests for margin collapsing. 2012-02-28 16:33:54 +01:00
Simon Sapin
953493733f Margin collapsing: not on the root element. 2012-02-28 14:54:20 +01:00
Simon Sapin
b8fa396d53 Margin collapsing: through "empty" elements. 2012-02-28 14:54:20 +01:00
Simon Sapin
28a53ef307 More collapsing margins again. 2012-02-28 14:54:20 +01:00
Guillaume Ayoub
016befd1af Handle the combined selectors with pseudo-elements 2012-02-27 17:55:27 +01:00
Simon Sapin
7167c3e637 Be more defensive. 2012-02-27 16:48:27 +01:00
Simon Sapin
82e52815fa Allow a file object as a positional argument in the API. 2012-02-27 15:59:26 +01:00
Simon Sapin
4fce42bd47 Do not monkeypatch sys.stdout in test_api.py: fix print debugging 2012-02-27 14:51:10 +01:00
Simon Sapin
5c4f627d10 TableBox.translate should translate column boxes too 2012-02-23 19:31:15 +01:00
Simon Sapin
e66e1025b0 More cases for margin collapsing 2012-02-23 19:31:15 +01:00
Simon Sapin
ceb8d749f8 Fix stdio monkey-patching on Python 3. 2012-02-23 19:31:15 +01:00
Simon Sapin
650b23ada8 Basic margin collapsing
Only between two siblings for now.
2012-02-23 19:31:15 +01:00
Simon Sapin
555ccbbd4f Port the W3 test runners to the new API. 2012-02-23 19:31:15 +01:00
Simon Sapin
7ad1083e88 Rename weasyprint.logging to avoid conflicts the stdlib module. 2012-02-23 19:31:15 +01:00
Simon Sapin
f0e79cf99a Cleanups 2012-02-23 19:31:15 +01:00
Simon Sapin
f6133af390 Correctly reset the list-item counter on new lists. 2012-02-23 19:31:15 +01:00
Guillaume Ayoub
a479fb67a0 Typo fix 2012-02-23 13:26:45 +01:00
Guillaume Ayoub
c5836405e9 Merge branch 'master' of github.com:Kozea/WeasyPrint 2012-02-23 13:19:21 +01:00
Guillaume Ayoub
b62e2712e0 Import the pystacia exception from the util module 2012-02-23 13:18:51 +01:00
Simon Sapin
af4aeb9376 Use pystacia instead of pypng in tests. 2012-02-22 14:13:14 +01:00
Simon Sapin
1c2b9da6bf Forget the pattern for JPEG, use a solid blue image
Not only is JPEG lossy, but the results of decoding the same file depends
on the version of libjpeg. #0000ff blue still comes out as #0000fe
with quality=100, let’s hope that much will stay consistent...
2012-02-22 12:11:44 +01:00
Simon Sapin
f5f9fc729c Switch to pystacia instead of PIL for raster images 2012-02-21 14:34:07 +01:00
Simon Sapin
0ef3b35e90 Actual python 2.6 compatibility 2012-02-21 14:13:34 +01:00
Simon Sapin
a412924e92 Fix the test suite on pytest
(Do not swallow all exceptions!)
2012-02-21 12:59:06 +01:00
Simon Sapin
dc5360e130 Python 2.6 compat, fix tox.ini 2012-02-20 15:36:55 +01:00
Simon Sapin
4bf9b2dce7 Switch to pytest 2012-02-20 13:04:35 +01:00
Simon Sapin
ff135aa285 Python 3 compat. All tests pass with the same code base! 2012-02-17 22:48:20 +01:00
Simon Sapin
0c0906b52a Fix the weasyprint.py script. 2012-02-17 15:00:55 +01:00
Simon Sapin
d5ee2ea509 Use the testing UA stylesheet in test_api.py 2012-02-16 18:52:36 +01:00
Simon Sapin
1337756504 Test the command line interface. 2012-02-16 18:28:18 +01:00
Simon Sapin
8a3dfa076f Fix --encoding and allow calling main(args) 2012-02-16 18:28:01 +01:00
Simon Sapin
38d687fa91 Nicer message on HTML parse error 2012-02-16 18:27:30 +01:00
Simon Sapin
6baad64044 Disable an assert that fails because of floating point errors. 2012-02-16 15:27:49 +01:00
Simon Sapin
af9c3e961e Test rendering with the Python API. 2012-02-16 14:42:08 +01:00
Simon Sapin
e63df09985 Test the HTML and CSS constructors. 2012-02-16 13:41:00 +01:00
Simon Sapin
cfb7bf4608 Take a base_url from file().name 2012-02-16 13:40:29 +01:00
Simon Sapin
6f9d5c068a Fix CSS(url=foo, base_url=bar) 2012-02-16 13:40:08 +01:00
Simon Sapin
7e728af99e Ooops 2012-02-15 19:01:09 +01:00
Simon Sapin
9cd1ac746d *Break the API*
The new API should be easier to use. Only what is directly
in the 'weasyprint' module (not in a sub-module) is public.
2012-02-15 18:49:37 +01:00
Simon Sapin
5fccd63885 CairoSVG supports these units now. 2012-02-15 18:41:48 +01:00
Simon Sapin
cf52aa3aaf Move the whole 'weasy' package to 'weasyprint' 2012-02-14 12:49:33 +01:00