def generate_example_rst(app):
root_dir = os.path.join(app.builder.srcdir, '<STR_LIT>')<EOL>example_dir = os.path.abspath(app.builder.srcdir + '<STR_LIT>' + '<STR_LIT>')<EOL>try:<EOL><INDENT>plot_gallery = eval(app.builder.config.plot_gallery)<EOL><DEDENT>except TypeError:<EOL><INDENT>plot_gallery = bool(app.builder.config.plot_gallery)<EOL><DEDENT>if not os.path.exists(example_dir):<EOL><INDENT>os.makedirs(example_dir)<EOL><DEDENT>if not os.path.exists(root_dir):<EOL><INDENT>os.makedirs(root_dir)<EOL><DEDENT>fhindex = file(os.path.join(root_dir, '<STR_LIT>'), '<STR_LIT:w>')<EOL>fhindex.write(
Generate the list of examples, as well as the contents of
        examples.