From 1ae3724038b4f6f7838fec416781ba14495c4e3f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 16 Aug 2009 15:41:34 -0600 Subject: [PATCH] New recipe for Cuba Debate by Darko Miletic. Also improve effectiveness of the linearize tables transform. --- .../ebooks/oeb/transforms/linearize_tables.py | 12 +++-- src/calibre/gui2/images/news/cubadebate.png | Bin 0 -> 858 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_cubadebate.py | 44 ++++++++++++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 src/calibre/gui2/images/news/cubadebate.png create mode 100644 src/calibre/web/feeds/recipes/recipe_cubadebate.py diff --git a/src/calibre/ebooks/oeb/transforms/linearize_tables.py b/src/calibre/ebooks/oeb/transforms/linearize_tables.py index 5842db90e5..92c3a00c7b 100644 --- a/src/calibre/ebooks/oeb/transforms/linearize_tables.py +++ b/src/calibre/ebooks/oeb/transforms/linearize_tables.py @@ -6,15 +6,19 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -from calibre.ebooks.oeb.base import OEB_DOCS, XPNSMAP +from calibre.ebooks.oeb.base import OEB_DOCS, XPath class LinearizeTables(object): def linearize(self, root): - for x in root.xpath('//h:table|//h:td|//h:tr|//h:th', - namespaces=XPNSMAP): + for x in XPath('//h:table|//h:td|//h:tr|//h:th|//h:caption|' + '//h:tbody|//h:tfoot|//h:thead|//h:colgroup|//h:col')(root): x.tag = 'div' - for attr in ('valign', 'colspan', 'rowspan', 'width', 'halign'): + for attr in ('style', 'font', 'valign', + 'colspan', 'width', 'height', + 'rowspan', 'summary', 'align', + 'cellspacing', 'cellpadding', + 'frames', 'rules', 'border'): if attr in x.attrib: del x.attrib[attr] diff --git a/src/calibre/gui2/images/news/cubadebate.png b/src/calibre/gui2/images/news/cubadebate.png new file mode 100644 index 0000000000000000000000000000000000000000..4f8fc9e4fcd9e3477beced5472b93fdd72796143 GIT binary patch literal 858 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87?_$pT^vI!PEVb5-uqUe#PR#*zh~Q@(EG>k z$MH%@WFmW~goyKtOKhx(%Do*4CS5l+-r%cz^PueJf`pP7Iiu@G7ue`1x+qOzZETsQ zDB=4lJFD)V^$a~W!*2%;KmTN-fA4%Z|A+92TUHiThRe!KcxVtjlc)Kh!seT694{@O za_K{e;lvNcsjXQB6W+WGjEQ*AUoppT`DDKKW@BSxo>r&pD)EdBL0rp@eYzMZBG=!n zB*1XNq%lZ=^XrFWj|-0^8J>Rm@}>EtIKfDBMh0{9`-xSz8iP8SI6NNwlhc?U7|PX_ zxFBk+*`!~8>!jK~wx-;1In0orZvWsJo71Ugjs-!CU9KUkLq)h+*&JLL9L&tjzV!9= zZI}A~?OsCmYS&GXk8T<#WUge}v5V^y!|H%x3p8a5R+do_i?cOW*V7x{EUF7xniu zcd~5Q)g`-KdU|^Lj9IgsOr%_mX1W9i3o|U(x>ZyyF2%W_HkFD=BAgb^4p`biH)V+O>%}IXrv!?%fcf!=T`|{Ii(KY)hM( z)5n!w|5XUQ{-3l@cfNYo*&p*~&7ZH|*V9w8=6KGtZ)E|crGbpE z;yG*V