home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- from __future__ import with_statement
- __license__ = 'GPL v3'
- __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
- __docformat__ = 'restructuredtext en'
- from calibre.utils.zipfile import ZipFile, ZIP_STORED
-
- def rules(stylesheets):
- for s in stylesheets:
- if hasattr(s, 'cssText'):
- for r in s:
- if r.type == r.STYLE_RULE:
- yield r
- continue
-
-
-
-
- def initialize_container(path_to_container, opf_name = 'metadata.opf'):
- 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
- zf = ZipFile(path_to_container, 'w')
- zf.writestr('mimetype', 'application/epub+zip', compression = ZIP_STORED)
- zf.writestr('META-INF/', '', 448)
- zf.writestr('META-INF/container.xml', CONTAINER)
- return zf
-
-