mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	inline_email_css: Extract configure_cssutils.
This commit is contained in:
		@@ -8,14 +8,7 @@ from cssutils.profiles import Profiles, properties, macros
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
 | 
					ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					def configure_cssutils() -> None:
 | 
				
			||||||
    escaped_jinja2_characters = [('%7B%7B%20', '{{ '), ('%20%7D%7D', ' }}'), ('>', '>')]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    templates_to_inline = set()
 | 
					 | 
				
			||||||
    for f in os.listdir(os.path.join(ZULIP_PATH, 'templates', 'zerver', 'emails')):
 | 
					 | 
				
			||||||
        if f.endswith('.source.html'):
 | 
					 | 
				
			||||||
            templates_to_inline.add(f.split('.source.html')[0])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # These properties are not supported by cssutils by default and will
 | 
					    # These properties are not supported by cssutils by default and will
 | 
				
			||||||
    # result in warnings when premailer package is run.
 | 
					    # result in warnings when premailer package is run.
 | 
				
			||||||
    properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
 | 
					    properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
 | 
				
			||||||
@@ -31,6 +24,16 @@ if __name__ == "__main__":
 | 
				
			|||||||
    profile.addProfiles([(Profiles.CSS_LEVEL_2, properties[Profiles.CSS_LEVEL_2],
 | 
					    profile.addProfiles([(Profiles.CSS_LEVEL_2, properties[Profiles.CSS_LEVEL_2],
 | 
				
			||||||
                         macros[Profiles.CSS_LEVEL_2])])
 | 
					                         macros[Profiles.CSS_LEVEL_2])])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 | 
					    escaped_jinja2_characters = [('%7B%7B%20', '{{ '), ('%20%7D%7D', ' }}'), ('>', '>')]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    templates_to_inline = set()
 | 
				
			||||||
 | 
					    for f in os.listdir(os.path.join(ZULIP_PATH, 'templates', 'zerver', 'emails')):
 | 
				
			||||||
 | 
					        if f.endswith('.source.html'):
 | 
				
			||||||
 | 
					            templates_to_inline.add(f.split('.source.html')[0])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    configure_cssutils()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    os.chdir(os.path.join(ZULIP_PATH, 'templates', 'zerver', 'emails'))
 | 
					    os.chdir(os.path.join(ZULIP_PATH, 'templates', 'zerver', 'emails'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user