#NEWLINE# def build_toc_etree( self , div , toc_list ) : #NEWLINE# #INDENT# if self . config [ 'title' ] : #NEWLINE# #INDENT# header = etree . SubElement ( div , 'span' ) #NEWLINE# header . attrib [ 'class' ] = 'toctitle' #NEWLINE# header . text = self . config [ 'title' ] #NEWLINE# #UNINDENT# def build_etree_ul( toc_list , parent ) : #NEWLINE# #INDENT# ul = etree . SubElement ( parent , 'ul' ) #NEWLINE# for item in toc_list : #NEWLINE# #INDENT# li = etree . SubElement ( ul , 'li' ) #NEWLINE# link = etree . SubElement ( li , 'a' ) #NEWLINE# link . text = item . get ( 'name' , '' ) #NEWLINE# link . attrib [ 'href' ] = ( '#' + item . get ( 'id' , '' ) ) #NEWLINE# if item [ 'children' ] : #NEWLINE# #INDENT# build_etree_ul ( item [ 'children' ] , li ) #NEWLINE# #UNINDENT# #UNINDENT# return ul #NEWLINE# #UNINDENT# return build_etree_ul ( build_etree_ul , div )