#NEWLINE# def depart_document( self , node ) : #NEWLINE# #INDENT# self . head_prefix . extend ( [ self . doctype , ( self . head_prefix_template % { #NEWLINE# #INDENT# 'lang' : self . settings . language_code , #NEWLINE# #UNINDENT# } ) ] ) #NEWLINE# self . html_prolog . append ( self . doctype ) #NEWLINE# self . meta . insert ( 0 , ( self . charset_decl % self . settings . output_encoding ) ) #NEWLINE# self . head . insert ( 0 , ( self . charset_decl % self . settings . output_encoding ) ) #NEWLINE# if self . math_header : #NEWLINE# #INDENT# if ( self . math_output == 'mathjax' ) : #NEWLINE# #INDENT# self . head . extend ( self . math_header ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . stylesheet . extend ( self . math_header ) #NEWLINE# #UNINDENT# #UNINDENT# self . html_head . extend ( node . head [ 1 : ] ) #NEWLINE# self . body_prefix . append ( self . starttag ( node , 'main' ) ) #NEWLINE# self . body_suffix . insert ( 0 , '</main>\n' ) #NEWLINE# self . fragment . extend ( self . body ) #NEWLINE# self . html_body . extend ( ( ( ( ( self . body_prefix [ 1 : ] + self . body_pre_docinfo ) + self . docinfo ) + self . body ) + self . body_suffix [ : ( - 1 ) ] ) ) #NEWLINE# assert ( not self . context ) , ( 'len(context) = %s' % len ( self . context ) )