#NEWLINE# def prepare( theme ) : #NEWLINE# #INDENT# for d in default_properties : #NEWLINE# #INDENT# if ( not theme . get ( d ) ) : #NEWLINE# #INDENT# theme . set ( d , default_properties [ d ] ) #NEWLINE# #UNINDENT# #UNINDENT# theme . footer_border_color = get_shade ( theme . footer_color , 10 ) #NEWLINE# theme . border_color = get_shade ( theme . background_color , 10 ) #NEWLINE# webfonts = list ( set ( ( theme . get ( key ) for key in ( 'heading_webfont' , 'text_webfont' ) if theme . get ( key ) ) ) ) #NEWLINE# theme . webfont_import = '\n' . join ( ( '@import url(https://fonts.googleapis.com/css?family={0}:400,300,400italic,700&subset=latin,latin-ext);' . format ( font . replace ( ' ' , '+' ) ) for font in webfonts ) ) #NEWLINE# if theme . css : #NEWLINE# #INDENT# if ( '@import url' in theme . css ) : #NEWLINE# #INDENT# webfont_import = list ( set ( re . findall ( '@import url\\([^\\(\\)]*\\);' , wfimport . css ) ) ) #NEWLINE# theme . webfont_import += ( '\n' + '\n' . join ( webfont_import ) ) #NEWLINE# for wfimport in webfont_import : #NEWLINE# #INDENT# theme . css = theme . css . replace ( wfimport , '' )