50 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
9480360bc8 py3: another warning about invalid escape 2019-07-19 16:26:02 +02:00
Eli Schwartz
45ca4c7934
py3: merge multiline __future__ imports to not confuse 2to3 2019-05-27 00:41:14 -04:00
Kovid Goyal
1473f4a83e
Forgot to remove unused dot object 2019-05-01 17:14:05 +05:30
Kovid Goyal
d324e776b5
Greatly simplify unicode_to_number
This also has the virtue of making number parsing locale independent, as
is required for parsing CSS literals
2019-05-01 17:10:21 +05:30
Kovid Goyal
3de9c83787
pep8 2019-05-01 16:42:43 +05:30
Kovid Goyal
cf220e7372
... 2019-04-02 15:12:27 +05:30
Kovid Goyal
152689812a
py3: Port use of Exception.message 2019-04-02 15:04:26 +05:30
Kovid Goyal
6272e4db9d
... 2019-04-02 10:37:41 +05:30
Kovid Goyal
ffb5160f3c
py3: Fix parsing of numbers in tinycss tokenizer 2019-04-02 10:34:01 +05:30
Kovid Goyal
f149427104
py3: Port use of (un)hexlify() 2019-03-30 14:34:48 +05:30
Kovid Goyal
5d46f5fbeb
Get rid of iterkeys
dict.__iter__() is the same as iterkeys on both py2 and py3
2019-03-25 14:31:32 +05:30
Eli Schwartz
4f545af415
autopep8 2019-03-24 01:18:27 -04:00
Eli Schwartz
a623717d96
python3: apply various fixes from python-modernize "dict_six"
Imports were then fixed and consolidated to derive from the internal
polyglot.builtins
2019-03-24 01:18:27 -04:00
Kovid Goyal
2d21a8efa2
Some more fixes for the unicode type
Now replaced in all dynamically loaded code. Recipes/metadata
sources/etc. In the case of recipes, since they get compiled by calibre
we simply make the unicode/unichr names available, no need for any
changes to the actual recipes themselves.
2019-03-13 12:04:47 +05:30
Kovid Goyal
dd7d8ea3c4
Switch from cssutils to css-parser
css-parser is a new fork of the unmaintained cssutils.
See https://github.com/ebook-utils/css-parser
2019-01-02 21:49:02 +05:30
Eli Schwartz
3fb2563d08 tokenizer: fix compile errors in merge of python3 port 2018-12-17 10:31:45 -05:00
Kovid Goyal
7463d23777
... 2018-12-10 11:52:05 +05:30
Kovid Goyal
36647d4762
Merge branch 'ft-py3-tokenizer' of https://github.com/flaviut/calibre 2018-12-10 11:24:10 +05:30
Flaviu Tamas
5f420d7047
Fix number->size conversion 2018-12-08 17:24:28 -05:00
Flaviu Tamas
cf576342e1
Build tokenizer on py3
- The actual unicode manipulation wasn't converted to the new 3.3+
style, since it would lead to lots of ifdefs and become quite ugly. This
can be done when py2 support is dropped. The drawbacks will be
temporary slower code (there will be extra copying required).
2018-12-08 17:24:18 -05:00
Kovid Goyal
5234e43f0e
Port future_builtins to polyglot 2018-09-10 20:12:01 +05:30
Flaviu Tamas
01fbf09c0b
Undo redundant imports & new-style raises
New-style rasies need to be redone in a py2-friendly way, and the
redudant imports are redudnant and can safely be removed
2018-09-10 12:11:29 +05:30
Flaviu Tamas
0889ee85ec
Fix syntax errors
Command used:

futurize --no-diffs -f libfuturize.fixes.fix_print_with_import -f lib2to3.fixes.fix_throw -f lib2to3.fixes.fix_numliterals -f lib2to3.fixes.fix_except -f lib2to3.fixes.fix_exec -f lib2to3.fixes.fix_raise -f lib2to3.fixes.fix_tuple_params -f lib2to3.fixes.fix_ne -j20 -w -n setup recipes src manual setup.py recipes/*.recipe

And manual adjustments of print((...)) -> print(...)
2018-09-10 12:11:28 +05:30
Kovid Goyal
aee8af31f3
Hide all symbols in the compiled python extensions on unix
They were already hidden on windows. Avoids the possibility of symbol
collisions and also means ld has to do less work when loading them
extensions.
2017-06-07 12:19:24 +05:30
Kovid Goyal
353e7c2b36 Fix subsetting of fonts whose names start with "and" not working
Caused by a bug in the font-family parsing routines of cssutils,
workaround by quoting the family name before passing it to cssutils.
2016-12-05 17:07:11 +05:30
Kovid Goyal
cf04fd266d DRYer 2016-07-17 09:55:39 +05:30
Kovid Goyal
75690f41f8 ... 2016-06-30 14:48:48 +05:30
Kovid Goyal
bb4fe4d924 Serialization of parsed fonts 2016-06-30 13:49:43 +05:30
Kovid Goyal
bbaf9875cc Use the new font parsing code for normalize_css 2016-06-30 12:25:28 +05:30
Kovid Goyal
b0b7a59afd Code to parse the font shorthand property 2016-06-30 11:07:51 +05:30
Kovid Goyal
f1122ac05f Discard empty strings when parsing font-family 2016-06-30 08:24:17 +05:30
Kovid Goyal
0643da49e0 ... 2016-06-30 08:22:19 +05:30
Kovid Goyal
553137015e Code to parse font family values 2016-06-30 08:18:15 +05:30
Kovid Goyal
538f0a7186 A single entry point to run all tests 2016-06-21 23:12:06 +05:30
Kovid Goyal
ef09e886b3 Change all shebangs to use python2 2015-01-23 19:08:21 +05:30
Kovid Goyal
1359f475af Edit Book: Live CSS: Fix clicking on link to go to style definition not working if the stylesheet contains CSS 3 media queries
Adds support for CSS 3 media query parsing to tinycss
2014-06-08 18:09:47 +05:30
Kovid Goyal
783b1d112b Use __slots__ for easy memory savings 2014-06-07 21:17:31 +05:30
Kovid Goyal
49e4d09cbc Refactor the @rule parsers into their own methods for easier sub-classing 2014-06-07 21:11:44 +05:30
Kovid Goyal
8ec267ae38 __repr__ for font-face rule 2014-06-07 20:57:11 +05:30
Kovid Goyal
397b7cc4e1 Edit Book: Live CSS: Fix going to style declaration in the editor not working correctly when the stylesheet contains @font-face rules 2014-06-07 14:38:27 +05:30
Kovid Goyal
9254dfeb0d Use the C tokenizer for tinycss 2014-05-25 08:46:04 +05:30
Kovid Goyal
322e6021e0 ... 2014-05-22 18:58:26 +05:30
Kovid Goyal
e7387aab1a Add tokenizer tests into the --test-build test suite 2014-05-22 16:36:23 +05:30
Kovid Goyal
a09869e9d8 ... 2014-05-22 16:18:32 +05:30
Kovid Goyal
04b45413c6 Testing for the C tokenizer 2014-05-22 15:23:25 +05:30
Kovid Goyal
adac7e6d1e Initial implementation of C code to speedup tinycss tokenization
Needs testing.
2014-05-22 14:17:15 +05:30
Kovid Goyal
1a71d61e8b Performance improvement 2014-05-21 16:52:50 +05:30
Kovid Goyal
f38af40146 Port the tinycss test suite to use the unittest module 2014-05-21 13:05:05 +05:30
Kovid Goyal
097d9e3099 Performance improvement 2014-05-21 11:19:20 +05:30
Kovid Goyal
d993534dfc Initial import of tinycss 2014-05-21 10:15:50 +05:30