#NEWLINE# def heading( headingtext , headinglevel , lang = 'en' ) : #NEWLINE# #INDENT# 'Make a new heading, return the heading element' #NEWLINE# lmap = { #NEWLINE# #INDENT# 'en' : 'Heading' , #NEWLINE# 'it' : 'Titolo' , #NEWLINE# #UNINDENT# } #NEWLINE# paragraph = makeelement ( 'p' ) #NEWLINE# pr = makeelement ( 'pPr' ) #NEWLINE# pStyle = makeelement ( 'pStyle' , attributes = { #NEWLINE# #INDENT# 'val' : ( lmap [ lang ] + str ( headinglevel ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# run = makeelement ( 'r' ) #NEWLINE# text = makeelement ( 't' , tagtext = headingtext ) #NEWLINE# pr . append ( pStyle ) #NEWLINE# run . append ( text ) #NEWLINE# paragraph . append ( pr ) #NEWLINE# paragraph . append ( run ) #NEWLINE# return paragraph