Skip to content

Instantly share code, notes, and snippets.

@joyrexus
Forked from texuf/premailerfixup.py
Created January 26, 2016 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joyrexus/b68c383b3d8ce51cb489 to your computer and use it in GitHub Desktop.
Save joyrexus/b68c383b3d8ce51cb489 to your computer and use it in GitHub Desktop.
fix for "WARNING Property: Unknown Property name." error from cssutils
from cssutils import profile
from cssutils.profiles import Profiles, properties, macros
#patch um up
properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
properties[Profiles.CSS_LEVEL_2]['-ms-text-size-adjust'] = r'none|auto|{percentage}'
properties[Profiles.CSS_LEVEL_2]['mso-table-lspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['mso-table-rspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}'
#re-add
profile.addProfiles([(Profiles.CSS_LEVEL_2,
properties[Profiles.CSS_LEVEL_2],
macros[Profiles.CSS_LEVEL_2]
)])
@joyrexus
Copy link
Author

Also consider turning off logging.

import logging
cssutils.log.setLevel(logging.CRITICAL)

@joyrexus
Copy link
Author

See if this addresses issue 1048.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment