#NEWLINE# def bug_role( role , rawtext , text , linenum , inliner , options = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , content = [ ] ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# bugnum = int ( text ) #NEWLINE# if ( bugnum <= 0 ) : #NEWLINE# #INDENT# raise ValueError #NEWLINE# #UNINDENT# #UNINDENT# except ValueError : #NEWLINE# #INDENT# msg = inliner . reporter . error ( ( 'Bug number must be a number greater than or equal to 1; "%s" is invalid.' % text ) , line = linenum ) #NEWLINE# prb = inliner . problematic ( rawtext , rawtext , msg ) #NEWLINE# return ( [ prb ] , [ msg ] ) #NEWLINE# #UNINDENT# bugtracker_url = content . document . settings . env . config . bugtracker_url #NEWLINE# if ( ( not bugtracker_url ) or ( '%s' not in bugtracker_url ) ) : #NEWLINE# #INDENT# msg = inliner . reporter . error ( 'bugtracker_url must be configured.' , line = linenum ) #NEWLINE# prb = inliner . problematic ( rawtext , rawtext , msg ) #NEWLINE# return ( [ prb ] , [ msg ] ) #NEWLINE# #UNINDENT# ref = ( bugtracker_url % bugnum ) #NEWLINE# node = nodes . reference ( rawtext , ( 'Bug #' + utils . unescape ( text ) ) , refuri = ref , ** options ) #NEWLINE# return ( [ node ] , [ ] )