#NEWLINE# def splitIntoSlides( document ) : #NEWLINE# #INDENT# body = domhelpers . findNodesNamed ( document , 'body' ) [ 0 ] #NEWLINE# slides = [ ] #NEWLINE# slide = [ ] #NEWLINE# title = '(unset)' #NEWLINE# for child in body . childNodes : #NEWLINE# #INDENT# if ( isinstance ( child , dom . Element ) and ( child . tagName == 'h2' ) ) : #NEWLINE# #INDENT# if slide : #NEWLINE# #INDENT# slides . append ( ( title , slide ) ) #NEWLINE# slide = [ ] #NEWLINE# #UNINDENT# title = domhelpers . getNodeText ( child ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# slide . append ( child ) #NEWLINE# #UNINDENT# #UNINDENT# slides . append ( ( title , slide ) ) #NEWLINE# return slides