#NEWLINE# def bootstrap_tabs( visitor , items ) : #NEWLINE# #INDENT# def format_id( s ) : #NEWLINE# #INDENT# return s . replace ( '.' , '-' ) #NEWLINE# #UNINDENT# txt = [ ] #NEWLINE# txt . append ( '<div class="tabbable">' ) #NEWLINE# txt . append ( '<ul class="nav nav-tabs">' ) #NEWLINE# for ( i , x ) in enumerate ( items ) : #NEWLINE# #INDENT# if ( 'title' not in x ) : #NEWLINE# #INDENT# x [ 'kwargs' ] [ 'title' ] = x [ 'kwargs' ] [ 'id' ] #NEWLINE# #UNINDENT# if ( i == 0 ) : #NEWLINE# #INDENT# cls = ' class="active"' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cls = '' #NEWLINE# #UNINDENT# txt . append ( ( '<li%s><a href="#%s" data-toggle="tab">%s</a></li>' % ( cls , format_id ( x [ 'kwargs' ] [ 'id' ] ) , x [ 'kwargs' ] [ 'title' ] ) ) ) #NEWLINE# #UNINDENT# txt . append ( '</ul>' ) #NEWLINE# txt . append ( '<div class="tab-content">' ) #NEWLINE# for ( i , x ) in enumerate ( items ) : #NEWLINE# #INDENT# if ( i == 0 ) : #NEWLINE# #INDENT# cls = ' active' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cls = '' #NEWLINE# #UNINDENT# txt . append ( ( '<div class="tab-pane%s" id="%s">' % ( cls , format_id ( x [ 'kwargs' ] [ 'id' ] ) ) ) ) #NEWLINE# text = visitor . parse_text ( x [ 'body' ] , 'article' ) #NEWLINE# txt . append ( text ) #NEWLINE# txt . append ( '</div>' ) #NEWLINE# #UNINDENT# txt . append ( '</div>' ) #NEWLINE# txt . append ( '</div>' ) #NEWLINE# return '\n' . join ( visitor )