def glyph_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
 target = options.get('target', None)
 glyph_name = 'glyphicon-{}'.format(text)
 if target:
  target = utils.unescape(target)
  new_element = nodes.reference(rawtext, ' ', refuri=target)
 else:
  new_element = nodes.container()
 classes = options.setdefault('class', [])
 classes += ['glyphicon', glyph_name]
 for custom_class in classes:
  new_element.set_class(custom_class)
 return ([new_element], [])

def glyph_role ( name , rawtext , text , lineno , inliner , options = { } , content = [ ] ) : target = options . get ( 'target' , None ) glyph_name = 'glyphicon-{}' . format ( text ) if target : target = utils . unescape ( target ) new_element = nodes . reference ( rawtext , ' ' , refuri = target ) else : new_element = nodes . container ( ) classes = options . setdefault ( 'class' , [ ] ) classes += [ 'glyphicon' , glyph_name ] for custom_class in classes : new_element . set_class ( custom_class ) return ( [ new_element ] , [ ] )
this function defines a glyph inline role that show a glyph icon from the twitter bootstrap framework *usage:* :glyph:<glyph_name> *example:* love this music :glyph:music :) can be subclassed to include a target *example:* .