def create_simple_html_directive(name, pre, post, has_content=True, match_titles=False):
 node_class = type(name.replace('-', '_'), (nodes.General, nodes.Element), {})
 def visit_html(self, node):
  self.body.append(pre)
 def depart_html(self, node):
  self.body.append(post)
 def run_directive(self):
  node = node_class()
  if has_content:
   text = self.content
   self.state.nested_parse(text, self.content_offset, node, match_titles=match_titles)
  self.state.document.settings.record_dependencies.add(__file__)
  return [node]
 directive_class = type((name.title() + 'Directive'), (Directive,), {'has_content': has_content, 'run': run_directive})
 def setup(app):
  app.add_node(node_class, html=(visit_html, depart_html))
  app.add_directive(name, directive_class)
 return (node_class, directive_class, setup)

def create_simple_html_directive ( name , pre , post , has_content = True , match_titles = False ) : node_class = type ( name . replace ( '-' , '_' ) , ( nodes . General , nodes . Element ) , { } ) def visit_html ( self , node ) : self . body . append ( pre ) def depart_html ( self , node ) : self . body . append ( post ) def run_directive ( self ) : node = node_class ( ) if has_content : text = self . content self . state . nested_parse ( text , self . content_offset , node , match_titles = match_titles ) self . state . document . settings . record_dependencies . add ( __file__ ) return [ node ] directive_class = type ( ( name . title ( ) + 'Directive' ) , ( Directive , ) , { 'has_content' : has_content , 'run' : run_directive } ) def setup ( app ) : app . add_node ( node_class , html = ( visit_html , depart_html ) ) app . add_directive ( name , directive_class ) return ( node_class , directive_class , setup )
creates a node class .