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

634 Commits

Author SHA1 Message Date
Simon Sapin
20fe60040d Document low-level output functions. 2012-09-20 17:57:15 +02:00
Simon Sapin
933554f7ed Moar docs for the low-level API. 2012-09-20 17:21:44 +02:00
Simon Sapin
19dd654678 Adapt docs for 0.15 2012-09-20 17:08:03 +02:00
Simon Sapin
a0853a3fc1 Merge branch 'sphinx-doc' 2012-09-20 16:53:33 +02:00
Simon Sapin
87d5741376 Integrate the sphinx docs with docstrings. 2012-09-19 17:37:52 +02:00
Simon Sapin
ac220e9a4d Refactor the PNG output to use the low-level API
… not intermediate ImageSurface objects.
2012-09-18 12:58:58 +02:00
Simon Sapin
c7422f721d Typo fix, thanks @jdahlin 2012-09-16 11:25:02 +03:00
Simon Sapin
0ff73c49bc Cache intermediate results for intrinsic widths on tables.
This fixes huges performance problems when a large table is split
across many pages.
2012-09-13 11:46:13 +02:00
Simon Sapin
9834ccb7e6 Handle all of backgrounds at the end of layout. 2012-09-13 11:19:40 +02:00
Simon Sapin
ae26c87bfd Handle background images at the end of layout 2012-09-13 10:41:22 +02:00
Simon Sapin
6354398139 Add a low-level public API 2012-09-12 19:33:16 +02:00
Simon Sapin
463a33c1af Fetch background images early
This removes the need to have a reference to the image cache
in draw.py
2012-09-12 18:36:00 +02:00
Simon Sapin
43bccc7345 Remove the ContextProxy
Instead, pass around the two objects in every function.
This is a bit heavy, but I find it much cleaner.
2012-09-12 17:14:51 +02:00
Simon Sapin
a29a37073f Merge commit 'FETCH_HEAD^' from git://github.com/jdahlin/WeasyPrint.git 2012-09-12 16:35:00 +02:00
Johan Dahlin
b0fb7a6e31 Convert drawing API to use context
Remove the need for a subclass and make it possible
to pass in other contextes such one created by the printing
functions in gtk+.
2012-09-12 16:31:00 +02:00
Simon Sapin
c0282bb000 Add a test for @page:blank 2012-09-12 16:22:38 +02:00
Simon Sapin
35540becb9 Add a work-around for some PyGTK installations. 2012-09-11 18:26:39 +02:00
Guillaume Ayoub
50210b266f Add support for @page:blank pseudo-class 2012-08-24 00:05:28 +02:00
Simon Sapin
39b553fae7 Add support for font-stretch, fix #7
The value is passed to Pango as-is. It may have no effect if
(for example) the chosen font has no expanded variant.
2012-08-17 17:37:33 +02:00
Simon Sapin
a09eb52b97 Tag v0.14 2012-08-03 17:55:14 +02:00
Simon Sapin
c2a88cfafc Fix saving of PNG images for failed tests. 2012-08-03 17:19:18 +02:00
Simon Sapin
20f46ea968 Fix #886, only apply clip to absopos. 2012-08-03 17:19:04 +02:00
Simon Sapin
ba8a55d5c0 Add support for outlines. 2012-08-03 16:22:32 +02:00
Simon Sapin
2614821fa9 Add support for <base href="..."> element in HTML. 2012-08-03 15:22:26 +02:00
Simon Sapin
d1971b6e63 Remove unused imports. 2012-08-03 13:32:42 +02:00
Simon Sapin
4abf401f9e Simplify Document and remove magic properties. 2012-08-03 13:00:14 +02:00
Simon Sapin
f4e6de438f Remove/adapt tests using Document.formatting_structure 2012-08-03 12:11:34 +02:00
Simon Sapin
ec8cbc6c24 Remove one-line methods in Document. 2012-08-03 11:51:58 +02:00
Simon Sapin
a19c02f7b1 Add --resolution and --base-url to the command-line API. 2012-08-02 17:19:52 +02:00
Simon Sapin
eab2646dcc Fix base_url set to a directory name.
With base_url='/a/b', a relative URL 'c' was resolved to '/a/c'.
Now it is resolved to '/a/b/c' if /a/b is a directory, '/a/c'
otherwise. This is most likely the expected behavior.
2012-08-02 17:19:34 +02:00
Simon Sapin
3b769e05c4 Add tests and changelog for the new media_type API. 2012-08-02 13:59:44 +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
4290b55d71 Remove a zip() pathologically slow on Py2.6
The Acid2 test used to take ~14 seconds on 2.6 vs. ~3 seconds in other
versions. Most of that time was in a zip() creating a list of millions
of tuples (one for each pixels.)

Switching to izip() removed the problem.
2012-07-31 18:13:25 +02:00
Simon Sapin
feece3d3c7 Always close pixbufs. 2012-07-31 18:10:44 +02:00
Simon Sapin
38129fabb6 Do not go to the network for the Acid2 test. 2012-07-31 17:33:55 +02:00
Simon Sapin
6809b5b7c9 Switch drawing tests back to RGBA. 2012-07-31 17:30:23 +02:00
Simon Sapin
cb659911d8 Add a specific error message for 0-byte images. 2012-07-31 15:08:01 +02:00
Simon Sapin
4c0bcc3b6e Mention pixbuf in the changelog. 2012-07-31 13:01:52 +02:00
Simon Sapin
f6861a43b9 Merge branch 'pixbuf' 2012-07-31 12:48:18 +02:00
Simon Sapin
da74638d3d Allow both RGB or RGBA PNG files in tests. 2012-07-30 17:33:31 +02:00
Simon Sapin
fb01c4c839 Work around getfilesystemencoding stupidity on Linux. 2012-07-30 12:01:20 +02:00
Simon Sapin
35c4c7cbe9 Merge branch 'master' into pixbuf
Conflicts:
	tox.ini
2012-07-29 18:42:48 +02:00
Simon Sapin
41e14d6e14 Overall niceties. 2012-07-29 18:39:16 +02:00
Simon Sapin
a34fd1a616 Remove a deprecation warning. 2012-07-29 18:38:59 +02:00
Simon Sapin
eca3e872a3 Fix the PyGTK version of gdkpixbuf_loader() 2012-07-29 18:23:53 +02:00
Simon Sapin
f522eac201 Use the same get_pixbuf() for both PyGTK and introspection. 2012-07-29 18:21:33 +02:00
Simon Sapin
1efd026ad0 Warn if gdk-pixbuf istoo old for introspection. 2012-07-29 18:13:33 +02:00
Simon Sapin
f46c334fa0 Remove the Pystacia dependency in tox.ini 2012-07-29 16:55:05 +02:00
Simon Sapin
abf256a810 Merge branch 'master' into pixbuf 2012-07-29 16:53:08 +02:00
Simon Sapin
9476dd99b7 Add a warning when Pango is too old. 2012-07-29 16:37:13 +02:00
Simon Sapin
cf9f982ec5 Default to PyGTK instead of PyGObject introspection. 2012-07-29 16:25:43 +02:00
Simon Sapin
c39d4119c8 Fix MIME type registering: always use native strings. 2012-07-29 15:13:45 +02:00
Simon Sapin
4f4fc0ee8e Make some drawing tests more robust ... maybe? 2012-07-29 15:13:16 +02:00
Simon Sapin
a02ebeff7e Merge branch 'master' into pixbuf 2012-07-28 23:04:10 +02:00
Simon Sapin
e2a5a32663 Make drawing tests with text less strict. 2012-07-28 23:03:51 +02:00
Simon Sapin
50c175a5dc Force the MIME types for the file extensions we care about. 2012-07-28 22:38:44 +02:00
Simon Sapin
67dc1c80e8 Start the changelog for 0.14 2012-07-28 22:33:20 +02:00
Simon Sapin
62016d2587 Apparently UnixInputStream doesn’t work well on sockets... 2012-07-28 22:26:58 +02:00
Simon Sapin
b3c059bc08 Switch to gdk-pixbuf for raster images instead of Pystacia. 2012-07-28 22:11:28 +02:00
Simon Sapin
0095d080b8 Always pass a list as font-family
... otherwise ','.join() will take a string character-by-character …
2012-07-28 19:23:54 +02:00
Simon Sapin
9447363f69 Do not pass Unicode filenames to pycairo.
Older versions (1.8 on py2) do not like that.
2012-07-28 15:28:35 +02:00
Simon Sapin
b1f0959df5 Use the filesystem encoding for file:// URLs. This might help with #891 2012-07-27 18:55:19 +02:00
Simon Sapin
84b45b7021 Apparently lxml on Windows does not like encoding='utf32'.
Let’s try with UTF-16BE.
2012-07-27 18:36:13 +02:00
Simon Sapin
96748be086 Gotta learn to run *all* tests before pushing. 2012-07-27 18:08:05 +02:00
Simon Sapin
2cab7b9c68 Remove the PyGTK vs. PyGObject 3 test, it did not bring much. 2012-07-27 17:56:31 +02:00
Simon Sapin
6be1d8b7f4 Fix some tests on Windows ... maybe? 2012-07-27 17:52:35 +02:00
Simon Sapin
501f690d49 Require at least 2 characters in URL schemes.
This makes sure that Windows filenames like C:\foo\bar.html
are not considered as URLs.
2012-07-27 17:19:17 +02:00
Simon Sapin
e0b8161897 Also always read the testing UA stylesheet from a filename. 2012-07-27 17:15:59 +02:00
Simon Sapin
627053da62 Read the HTML5 stylesheet from a file.
Windows filenames C:\... may look like URLs.
Make sure that the HTML5 UA stylesheet is always read from a file.
2012-07-27 00:31:03 +03:00
Simon Sapin
fbfbdac032 Faster loading of non-PNG images. 2012-07-26 12:32:08 +02:00
Simon Sapin
1fa71a7036 Tag v0.13 2012-07-23 19:15:19 +02:00
Simon Sapin
4730e414ef Add PyGTK compatiblity (vs. PyGObject 3.x)
First try to import Pango through PyGObject 3.x and introspection.

If that fails or if the WEASYPRINT_USE_PYGTK is set and non-empty,
fall back on PyGTK and the "old-style" bindings without introspection.
2012-07-23 19:01:23 +02:00
Simon Sapin
30533879b2 Fixed #2: Crash in PDF outlines with malformed bookmark-level sequence. 2012-07-23 16:12:45 +02:00
Simon Sapin
47e1289472 Do not print logs on passing tests. 2012-07-23 16:07:52 +02:00
Simon Sapin
efdf1b4af5 Do not write any PNG in test_output unless a test fails 2012-07-23 16:07:32 +02:00
Simon Sapin
714fc401d0 Tag v0.12 2012-07-19 11:55:21 +02:00
Simon Sapin
d3bf05a507 Mark some tests as expected fails on cairo < 1.12 2012-07-18 15:37:37 +02:00
Simon Sapin
4a6fff4384 Make mime_type optional in custom URL fetchers 2012-07-18 14:34:43 +02: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
2768dea548 Add `url_fetcher` to the public API 2012-07-13 12:24:55 +02:00
Simon Sapin
d401e7241b Kill Document in layout/*.py 2012-07-12 17:13:21 +02:00
Simon Sapin
cca18bdfe9 Kill Document in pdf.py and text.py 2012-07-12 16:14:35 +02:00
Simon Sapin
30a5708373 Kill Document in formatting_structure/build.py and html.py 2012-07-12 15:54:22 +02:00
Simon Sapin
d038708b8b Kill Document in css/__init__.py 2012-07-12 15:21:37 +02:00
Simon Sapin
163b85bae4 Kill Document in draw.py 2012-07-12 15:13:08 +02:00
Simon Sapin
0d3d1f1fd5 Collapsed borders intersections should be rectangles, not squares. 2012-07-12 11:10:18 +02:00
Simon Sapin
e955781b91 Fix border-collapse on multiple pages 2012-07-11 19:23:41 +02:00
Simon Sapin
34fc003c57 Paint collapsed table borders 2012-07-11 18:21:20 +02:00
Simon Sapin
fd96c0df0a Ignore margins on internal table boxes: fix #888
Also ignore padding on table with border-collapse
2012-07-11 16:39:17 +02:00
Simon Sapin
002ed3a99e Ignore border-spacing when border-collapse is 'collapse'
Also remove TODOs in preferred.py:
'when border-collapse: collapse; set outer=False'

build.py sets transparent borders half as wide as the
collapsed border on each cell, so the layout should
just work unchanged.
2012-07-11 15:43:18 +02:00
Simon Sapin
1deb3c3b43 Add border conflict resolution for border-collapse
(No layout or painting yet.)
2012-07-11 14:11:26 +02:00
Simon Sapin
c2a88ec8df Use bare commas without spaces for Pango.FontDescription.set_family
Fix a pontential bug reported by Peter Moulder

pjrm: In text.py's call to set_family, note that it's safer
to use ','.join (i.e. without a space).  Some versions of
pango (possibly including the current one) have a bug in
some of the places where a family list is parsed, but using
a plain comma (without space) fixes that.
2012-07-10 15:17:42 +02:00
Simon Sapin
925669d37c Fix floats across pages. 2012-07-06 18:35:23 +02:00
Simon Sapin
ebf372316d Deduplicate 'clear' in TABLE_WRAPPER_BOX_PROPERTIES 2012-07-06 11:51:03 +02:00
Simon Sapin
5ca1d9ab3a Next is 0.12. Or is it? 2012-07-04 19:53:20 +02:00
Simon Sapin
ffda839f5e Add the changelog for 0.11 2012-07-04 14:29:11 +02:00
Simon Sapin
279386b850 Unprefix paged media, transforms, and SVG properties
The image-rendering, transform, transform-origin and size
properties are now unprefixed.

The prefixed form (eg. -weasy-size) is ignored but gives
a specific warning.
2012-07-04 11:27:20 +02:00
Simon Sapin
1cdb6257f4 Navigator: download PDFs with a .pdf filename 2012-07-03 15:46:35 +02:00
Simon Sapin
0c89a73a47 Navigator: clip links outside the page. 2012-07-03 15:10:46 +02:00
Simon Sapin
477b849363 Navigator: add links to some example pages 2012-07-03 15:10:25 +02:00
Simon Sapin
22cb02c01a Update page sizing to the current ED
Namely:

* The size sets the page’s containing block
* 'auto' margins are now supported
* The width, min-width, max-width, height, min-height
  and max-height properties are now supported.
2012-07-03 14:54:15 +02:00
Simon Sapin
fb3777b317 Get rid of page.outer_width and outer_height
.margin_width() and .margin_height() can be used instead.
2012-07-03 14:07:39 +02:00
Simon Sapin
b89926284a Fix the Variable Dimension rules, add tests.
This implements the updated algorithm described in
https://github.com/SimonSapin/css/blob/81b5d93d0d/margin-boxes-variable-dimension
2012-07-02 18:15:57 +02:00
Simon Sapin
e28fdb557b Implement a simpler version of Variable Dimension for margin boxes.
https://github.com/SimonSapin/css/blob/8c17fbe/margin-boxes-variable-dimension
2012-07-02 11:07:44 +02:00
Simon Sapin
13184721be Non-auto width is not enough anymore for a page-margin box
The latest ED makes no mention of non-auto widths for
generating page-margin boxes. Only 'content: none' matters:

http://dev.w3.org/csswg/css3-page/#populating-margin-boxes
2012-07-02 11:07:44 +02:00
Simon Sapin
694863ed62 Fix crashes.
* Some fixed boxes did not have any layout
* Validator for the 'float' property masked the builtin,
  float('inf') returned None.
2012-06-29 17:13:10 +02:00
Simon Sapin
80af286655 Merge branch 'float' into 'master' 2012-06-29 11:40:00 +02:00
Simon Sapin
edfbd90566 W3C test suite runner: render in an iframe
In case rendering fails with an exception, the Werkzeug
debugger is in the iframe. The browser’s rendering and
the HTML source are still visible.
2012-06-29 11:38:57 +02:00
Simon Sapin
6d5e473993 Fix inline floated images. 2012-06-28 19:07:26 +02:00
Simon Sapin
c36d6b6b29 Intrinsic widths: account for floats in inline contexts 2012-06-28 18:46:54 +02:00
Simon Sapin
cf822b981f Use the Acid2 version from webstandards.org
It uses http://www.webstandards.org/404/ instead of
http://www.damowmow.com/404/ and thus does not have
network problems.

Also, using the new get_png_pages() API we can get
each page separately. No custom stylesheet is needed
anymore.
2012-06-28 17:41:42 +02:00
Simon Sapin
45a09df4a8 Set the network timeout to 1 second for Acid2
Acid2 uses http://www.damowmow.com/404/ which apparently has
a broken IPv6 setup.
2012-06-28 14:01:03 +02:00
Simon Sapin
f808cacd09 Fix waiting_floats with spans 2012-06-28 14:00:27 +02:00
Simon Sapin
f0b04a8e37 Merge branch 'master' into float 2012-06-28 13:30:23 +02:00
Simon Sapin
f65619f452 Fix whitespace collapsing across not-in-normal-flow boxes. 2012-06-28 13:29:12 +02:00
Simon Sapin
c6a9c9a151 Fix a shrink_to_fit call: CB width instead of the CB box 2012-06-28 12:00:15 +02:00
Simon Sapin
5e61048014 Remove import of a removed module. 2012-06-28 11:59:36 +02:00
Guillaume Ayoub
85753abc7f Re-add a test that was failing 2012-06-28 09:09:15 +02:00
Guillaume Ayoub
01c451b542 Don't collapse margins in table wrappers, remove a double translation
With this version, a lot of tests are OK. The main missing feature is the
unsupported margin collapsing through nested boxes. Once this is fixed, the
branch can be considered as stable.
2012-06-28 04:14:06 +02:00
Guillaume Ayoub
5e270133c8 Use the border height instead of the margin height to find floats with no height
Fixes Acid2
2012-06-28 01:42:28 +02:00
Guillaume Ayoub
228f1e3d77 Fix most of the tests (but not Acid2) 2012-06-28 00:51:24 +02:00
Guillaume Ayoub
d3eb130fc0 Fix *again* the split_inline_box calls in the tests 2012-06-26 00:21:50 +02:00
Guillaume Ayoub
19d0a6aff5 Merge branch 'master' into float 2012-06-25 23:55:54 +02:00
Guillaume Ayoub
9afa96e987 Put floats in the next line when they don't fit on current line 2012-06-25 23:48:21 +02:00
Guillaume Ayoub
762a8db2be Don't detect collisions with 0-height boxes only for float boxes 2012-06-25 23:47:07 +02:00
Guillaume Ayoub
2f68f0f519 Again! 2012-06-25 21:37:15 +02:00
Guillaume Ayoub
b26d35cd96 Don't resolve percentages on tables 2012-06-25 21:35:45 +02:00
Guillaume Ayoub
4c824f7374 Don't create new lines for floats with height = 0 2012-06-25 21:10:00 +02:00
Guillaume Ayoub
6bccfe7514 Fix a lot of things about floats 2012-06-25 19:48:22 +02:00
Simon Sapin
f01e714192 Tag v0.10 2012-06-25 16:12:04 +02:00
Simon Sapin
6eee86dadf Fix Navigator tests on Py2.6 2012-06-25 16:09:40 +02:00
Guillaume Ayoub
8c4cf4118d Remove print 2012-06-25 12:51:13 +02:00
Guillaume Ayoub
f15cb85d1d Merge branch 'master' into float 2012-06-25 12:48:11 +02:00
Guillaume Ayoub
683afe9f3a Fix tests 2012-06-25 12:47:15 +02:00
Simon Sapin
c2375d2f5c Do not require JavaScript in Navigator
And other niceties.
2012-06-25 10:57:38 +02:00
Guillaume Ayoub
3b740f32a6 Fix stupid bug 2012-06-25 10:21:42 +02:00
Guillaume Ayoub
b61f57b97c Avoid collision of replaced blocks and tables with floats 2012-06-25 10:17:39 +02:00
Guillaume Ayoub
b67bebfb92 Fix the position of line children next to float boxes 2012-06-24 00:03:45 +02:00
Guillaume Ayoub
aee82fd576 Add a todo and fix a little thing about text align for floats in inline 2012-06-23 13:05:08 +02:00
Guillaume Ayoub
a3cc6c62a8 Merge branch 'master' into float 2012-06-23 11:51:05 +02:00
Guillaume Ayoub
1c9a910c5f Merge branch 'master' of github.com:Kozea/WeasyPrint 2012-06-23 11:50:38 +02:00
Guillaume Ayoub
6c4f05fb54 Remove useless import 2012-06-23 11:50:10 +02:00
Guillaume Ayoub
e696d2b196 Translate children moved by floats (but no available_width shrink yet) 2012-06-23 11:47:38 +02:00
Simon Sapin
78461b81f1 Test the Navigator 2012-06-23 04:58:14 +02:00
Simon Sapin
18cc2958b2 Move the Navigator startup out of exception handling.
Otherwise, any other traceback would be prefixed with:

Traceback (most recent call last):
  File "weasyprint/navigator.py", line 160, in run
    from werkzeug.serving import run_simple
ImportError: No module named werkzeug.serving

During handling of the above exception, another exception occurred:
2012-06-23 04:22:10 +02:00
Guillaume Ayoub
989ae739ef Merge branch 'master' into float
Comment failing tests too :(

Conflicts:
	weasyprint/document.py
	weasyprint/draw.py
2012-06-23 02:00:09 +02:00
Simon Sapin
03a0ee1079 Add a PDF button to Navigator. 2012-06-22 19:01:21 +02:00
Simon Sapin
6483c69e02 Rewrite Navigator to run without Flask. 2012-06-22 18:48:52 +02:00