Пример #1
0
    def process_resource_entry(self, target, ext, css_media, prefix, resource):
        """
        Process the given (raw) resource.
        """
        prefix, resource = super(ResourceManagerExtension,
                                 self).process_resource_entry(
                                     target, ext, css_media, prefix, resource)

        # if we are rendering css and the resource is a font,
        # then substitude it with its corresponding font css
        # file
        if ext == '.css' and prefix == 'font':
            font_declaration = FontCache.get_font_declaration(resource)
            if font_declaration is not None:
                resource = FontCache.get_font_css_url(
                    font_declaration.font_name)
                prefix = 'screen'

        return prefix, resource
Пример #2
0
 def test_should_patrse_font_declaration(self):
     d = FontCache.get_font_declaration('Open Sans:300,300i')
     self.assertIsInstance(d, FontDeclaration)
     self.assertEqual('Open Sans', d.font_name)
     self.assertEqual(['300', '300i'], d.variants_display)