home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_888 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  1.4 KB  |  29 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__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
  7. __docformat__ = 'restructuredtext en'
  8. from calibre.utils.zipfile import ZipFile, ZIP_STORED
  9.  
  10. def rules(stylesheets):
  11.     for s in stylesheets:
  12.         if hasattr(s, 'cssText'):
  13.             for r in s:
  14.                 if r.type == r.STYLE_RULE:
  15.                     yield r
  16.                     continue
  17.             
  18.     
  19.  
  20.  
  21. def initialize_container(path_to_container, opf_name = 'metadata.opf'):
  22.     CONTAINER = '<?xml version="1.0"?>\n<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">\n   <rootfiles>\n      <rootfile full-path="%s" media-type="application/oebps-package+xml"/>\n   </rootfiles>\n</container>\n    ' % opf_name
  23.     zf = ZipFile(path_to_container, 'w')
  24.     zf.writestr('mimetype', 'application/epub+zip', compression = ZIP_STORED)
  25.     zf.writestr('META-INF/', '', 448)
  26.     zf.writestr('META-INF/container.xml', CONTAINER)
  27.     return zf
  28.  
  29.