Пример #1
0
 def __call__(self, container):
     root = container.parsed(self.name)
     container.dirty(self.name)
     if container.mime_map[self.name] in OEB_DOCS:
         for style in root.xpath('//*[local-name()="style"]'):
             if style.get('type', 'text/css') == 'text/css' and style.text and style.text.strip():
                 fix_style_tag(container, style)
         for elem in root.xpath('//*[@style]'):
             raw = elem.get('style')
             if raw:
                 elem.set('style', force_unicode(container.parse_css(raw, is_declaration=True).cssText, 'utf-8').replace('\n', ' '))
     return True
Пример #2
0
 def __call__(self, container):
     root = container.parsed(self.name)
     container.dirty(self.name)
     if container.mime_map[self.name] in OEB_DOCS:
         for style in root.xpath('//*[local-name()="style"]'):
             if style.get('type', 'text/css') == 'text/css' and style.text and style.text.strip():
                 fix_style_tag(container, style)
         for elem in root.xpath('//*[@style]'):
             raw = elem.get('style')
             if raw:
                 elem.set('style', force_unicode(container.parse_css(raw, is_declaration=True).cssText, 'utf-8').replace('\n', ' '))
     return True
Пример #3
0
 def __call__(self, container):
     root = container.parsed(self.name)
     container.dirty(self.name)
     if container.mime_map[self.name] in OEB_DOCS:
         for style in root.xpath('//*[local-name()="style"]'):
             if style.get("type", "text/css") == "text/css" and style.text and style.text.strip():
                 fix_style_tag(container, style)
         for elem in root.xpath("//*[@style]"):
             raw = elem.get("style")
             if raw:
                 elem.set(
                     "style",
                     force_unicode(container.parse_css(raw, is_declaration=True).cssText, "utf-8").replace(
                         "\n", " "
                     ),
                 )
     return True