#NEWLINE# def linkTextsFromElement( el , preserveCasing = False ) : #NEWLINE# #INDENT# from . htmlhelpers import find , textContent #NEWLINE# if ( el . get ( 'data-lt' ) == '' ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if el . get ( 'data-lt' ) : #NEWLINE# #INDENT# rawText = el . get ( 'data-lt' ) #NEWLINE# if ( rawText in [ '|' , '||' , '|||' ] ) : #NEWLINE# #INDENT# texts = [ rawText ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# texts = [ x . strip ( ) for x in rawText . split ( '|' ) ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( el . tag in ( 'dfn' , 'a' ) ) : #NEWLINE# #INDENT# texts = [ textContent ( el ) . strip ( ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( el . tag in ( 'h2' , 'h3' , 'h4' , 'h5' , 'h6' ) ) : #NEWLINE# #INDENT# texts = [ textContent ( find ( '.content' , el ) ) . strip ( ) ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if el . get ( 'data-local-lt' ) : #NEWLINE# #INDENT# localTexts = [ x . strip ( ) for x in el . get ( 'data-local-lt' ) . split ( '|' ) ] #NEWLINE# for text in localTexts : #NEWLINE# #INDENT# if ( text in texts ) : #NEWLINE# #INDENT# raise DuplicatedLinkText ( text , ( texts + localTexts ) , el ) #NEWLINE# #UNINDENT# #UNINDENT# texts += localTexts #NEWLINE# #UNINDENT# texts = [ x for x in texts if ( x != '' ) ] #NEWLINE# return texts