#NEWLINE# def visit_youtube_node( self , node ) : #NEWLINE# #INDENT# aspect = node [ 'aspect' ] #NEWLINE# width = node [ 'width' ] #NEWLINE# height = node [ 'height' ] #NEWLINE# if ( aspect is None ) : #NEWLINE# #INDENT# aspect = ( 16 , 9 ) #NEWLINE# #UNINDENT# if ( ( height is None ) and ( width is not None ) and ( width [ 1 ] == '%' ) ) : #NEWLINE# #INDENT# style = { #NEWLINE# #INDENT# 'padding-top' : ( '%dpx' % CONTROL_HEIGHT ) , #NEWLINE# 'padding-bottom' : ( '%f%%' % ( ( width [ 0 ] * aspect [ 1 ] ) / aspect [ 0 ] ) ) , #NEWLINE# 'width' : ( '%d%s' % width ) , #NEWLINE# 'position' : 'relative' , #NEWLINE# #UNINDENT# } #NEWLINE# self . body . append ( self . starttag ( node , 'div' , style = css ( style ) ) ) #NEWLINE# style = { #NEWLINE# #INDENT# 'position' : 'absolute' , #NEWLINE# 'top' : '0' , #NEWLINE# 'left' : '0' , #NEWLINE# 'width' : '100%' , #NEWLINE# 'height' : '100%' , #NEWLINE# 'border' : '0' , #NEWLINE# #UNINDENT# } #NEWLINE# attrs = { #NEWLINE# #INDENT# 'src' : ( 'http://www.youtube.com/embed/%s' % node [ 'id' ] ) , #NEWLINE# 'style' : css ( style ) , #NEWLINE# #UNINDENT# } #NEWLINE# self . body . append ( self . starttag ( node , 'iframe' , ** attrs ) ) #NEWLINE# self . body . append ( '</iframe></div>' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( width is None ) : #NEWLINE# #INDENT# if ( height is None ) : #NEWLINE# #INDENT# width = ( 560 , 'px' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# width = ( ( ( height [ 0 ] * aspect [ 0 ] ) / aspect [ 1 ] ) , 'px' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( height is None ) : #NEWLINE# #INDENT# height = ( ( ( width [ 0 ] * aspect [ 1 ] ) / aspect [ 0 ] ) , 'px' ) #NEWLINE# #UNINDENT# style = { #NEWLINE# #INDENT# 'width' : ( '%d%s' % width ) , #NEWLINE# 'height' : ( '%d%s' % ( ( height [ 0 ] + CONTROL_HEIGHT ) , height [ 1 ] ) ) , #NEWLINE# 'border' : '0' , #NEWLINE# #UNINDENT# } #NEWLINE# attrs = { #NEWLINE# #INDENT# 'src' : ( 'http://www.youtube.com/embed/%s' % node [ 'id' ] ) , #NEWLINE# 'style' : css ( style ) , #NEWLINE# #UNINDENT# } #NEWLINE# self . body . append ( self . starttag ( node , 'iframe' , ** attrs ) ) #NEWLINE# self . body . append ( '</iframe>' )