parameters: (self, out, scope)
docstring: This function executes a chunk.  For strings, lists, text chunks, etc., this just
             entails returning the chunk's value.  For callable macros, this executes and returns
             the chunk's value.
docstring_summary: This function executes a chunk.  For strings, lists, text chunks, etc., this just
             entails returning the chunk's value.  For callable macros, this executes and returns
             the chunk's value.
docstring_tokens: This function executes a chunk . For strings lists text chunks etc . this just entails returning the chunk s value . For callable macros this executes and returns the chunk s value .
function: def execute(self, out, scope):
          """This function executes a chunk.  For strings, lists, text chunks, etc., this just
             entails returning the chunk's value.  For callable macros, this executes and returns
             the chunk's value.
          """
          if not self.macro:
              out.write(self.text)
          else:
              if not self.macro in scope:
                  error_msg = "Invalid macro: '%s'" % self.macro
                  if scope.function_name:
                      error_msg += " for " + scope.function_name
                  syntax_error(error_msg)
  
              value = scope[self.macro]
              if hasattr(value, "__call__"):
                  # It's a macro, so we need to execute it.  But first evaluate its args.
                  def eval_arg(arg):
                      if isinstance(arg, Chunk):
                          return arg.execute(out, scope)
                      else:
                          return arg
                  args = [eval_arg(arg) for arg in self.args]
                  return value(out, scope, args, self.children)
              elif isinstance(value, list):
                  # Special case for handling lists and list indexing
                  return handle_list(self.macro, value, self.args)
              else:
                  # Just return the value of anything else
                  return value
function_tokens: def execute ( self , out , scope ) : if not self . macro : out . write ( self . text ) else : if not self . macro in scope : error_msg = "Invalid macro: '%s'" % self . macro if scope . function_name : error_msg += " for " + scope . function_name syntax_error ( error_msg ) value = scope [ self . macro ] if hasattr ( value , "__call__" ) : # It's a macro, so we need to execute it.  But first evaluate its args. def eval_arg ( arg ) : if isinstance ( arg , Chunk ) : return arg . execute ( out , scope ) else : return arg args = [ eval_arg ( arg ) for arg in self . args ] return value ( out , scope , args , self . children ) elif isinstance ( value , list ) : # Special case for handling lists and list indexing return handle_list ( self . macro , value , self . args ) else : # Just return the value of anything else return value