home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1006 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  1.7 KB  |  31 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from __future__ import with_statement
  5. __license__ = 'GPL v3'
  6. __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
  7. __docformat__ = 'restructuredtext en'
  8. from calibre.ebooks.oeb.base import OEB_DOCS, XPath, XHTML
  9.  
  10. class LinearizeTables(object):
  11.     
  12.     def linearize(self, root):
  13.         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):
  14.             x.tag = XHTML('div')
  15.             for attr in ('style', 'font', 'valign', 'colspan', 'width', 'height', 'rowspan', 'summary', 'align', 'cellspacing', 'cellpadding', 'frames', 'rules', 'border'):
  16.                 if attr in x.attrib:
  17.                     del x.attrib[attr]
  18.                     continue
  19.             
  20.         
  21.  
  22.     
  23.     def __call__(self, oeb, context):
  24.         for x in oeb.manifest.items:
  25.             if x.media_type in OEB_DOCS:
  26.                 self.linearize(x.data)
  27.                 continue
  28.         
  29.  
  30.  
  31.