#NEWLINE# def begin_text_resource( self , resource , text ) : #NEWLINE# #INDENT# '\n        Replace @import statements with {% include %} statements.\n        ' #NEWLINE# if ( ( not self . _should_parse_resource ( resource ) ) or ( not self . _should_replace_imports ( resource ) ) ) : #NEWLINE# #INDENT# return text #NEWLINE# #UNINDENT# import_finder = re . compile ( '^\\s*@import\\s+(?:\'|")([^\'"]*)(?:\'|")\\s*\\;\\s*$' , re . MULTILINE ) #NEWLINE# def import_to_include( match ) : #NEWLINE# #INDENT# if ( not match . lastindex ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# path = match . groups ( 1 ) [ 0 ] #NEWLINE# afile = File ( resource . source_file . parent . child ( path ) ) #NEWLINE# if ( len ( afile . kind . strip ( ) ) == 0 ) : #NEWLINE# #INDENT# afile = File ( ( afile . path + '.ccss' ) ) #NEWLINE# #UNINDENT# ref = self . site . content . resource_from_path ( afile . path ) #NEWLINE# if ( not ref ) : #NEWLINE# #INDENT# raise HydeException ( ( 'Cannot import from path [%s]' % afile . path ) ) #NEWLINE# #UNINDENT# ref . is_processable = False #NEWLINE# return self . template . get_include_statement ( ref . relative_path ) #NEWLINE# #UNINDENT# text = import_finder . sub ( import_to_include , text ) #NEWLINE# return text