List all found admonition from all the rst files found in directory.

    view_meta_admonition is called by the 'meta' url: /__XXXXXXX__
    where XXXXXXX represents and admonition name, like:

    * todo
    * warning
    * danger
    * ...

    .. note:: this function may works for any docutils node, not only
       admonition

    Keyword Arguments:

        :admonition_name: (str) -- name of the admonition

def view_meta_admonition(admonition_name, name=None):
    """List all found admonition from all the rst files found in directory.

    view_meta_admonition is called by the 'meta' url: /__XXXXXXX__
    where XXXXXXX represents and admonition name, like:

    * todo
    * warning
    * danger
    * ...

    .. note:: this function may works for any docutils node, not only
       admonition

    Keyword Arguments:

        :admonition_name: (str) -- name of the admonition
    """
    print("meta admo: %s - %s" % (admonition_name, name))
    admonition = None

    if admonition_name == 'todo':
        admonition = todo
    elif admonition_name == 'done':
        admonition = done
    elif hasattr(nodes, admonition_name):
        admonition = getattr(nodes, admonition_name)
    else:
        return abort(404)

    doc2_content = ""

    doc2_output, doc2_pub = docutils.core.publish_programmatically(
        source_class=io.StringInput,
        source=doc2_content,
        source_path=None,
        destination_class=io.StringOutput,
        destination=None, destination_path=None,
        reader=None, reader_name='standalone',
        parser=None, parser_name='restructuredtext',
        writer=AttowikiWriter(), writer_name=None,
        settings=None, settings_spec=None,
        settings_overrides=None,
        config_section=None,
        enable_exit_status=False)

    section1 = nodes.section("{0}_list_file".format(admonition_name))
    doc2_pub.reader.document.append(section1)
    title1 = nodes.title("{0} LIST".format(admonition_name.upper()),
                         "{0} LIST".format(admonition_name.upper()))
    doc2_pub.reader.document.append(title1)
    if name is None:
        rst_files = [filename[2:-4] for filename in sorted(
            glob.glob("./*.rst"))]
        rst_files.reverse()
    else:
        rst_files = [filename[2:-4] for filename in
                     sorted(glob.glob("./{0}.rst".format(name)))]
    for file in rst_files:
        file_title = False
        file_handle = open(file + '.rst', 'r')
        file_content = file_handle.read()
        file_handle.close()
        file_content = file_content.decode('utf-8')

        output, pub = docutils.core.publish_programmatically(
            source_class=io.StringInput, source=file_content,
            source_path=None,
            destination_class=io.StringOutput,
            destination=None, destination_path=None,
            reader=None, reader_name='standalone',
            parser=None, parser_name='restructuredtext',
            writer=None, writer_name='html',
            settings=None, settings_spec=None,
            settings_overrides=None,
            config_section=None,
            enable_exit_status=False)

        my_settings = pub.get_settings()
        parser = docutils.parsers.rst.Parser()
        document = docutils.utils.new_document('test', my_settings)
        parser.parse(file_content, document)
        for node in document.traverse(admonition):
            if not file_title:
                file_title = True
                # new section
                section2 = nodes.section(file)
                doc2_pub.reader.document.append(section2)
                # add link to the originating file
                paragraph = nodes.paragraph()
                file_target = nodes.target(ids=[file],
                                           names=[file],
                                           refuri="/" + file)
                file_ref = nodes.reference(file, file,
                                           name=file,
                                           refuri="/" + file)
                paragraph.append(nodes.Text("in "))
                paragraph.append(file_ref)
                paragraph.append(file_target)
                paragraph.append(nodes.Text(":"))
                doc2_pub.reader.document.append(paragraph)
                # doc2_pub.reader.document.append(file_target)

            doc2_pub.reader.document.append(node)
        doc2_pub.apply_transforms()

    doc2_pub.writer.write(doc2_pub.document, doc2_pub.destination)
    doc2_pub.writer.assemble_parts()
    if name is None:
        display_file_name = '__{0}__'.format(admonition_name)
        extended_name = None
    else:
        display_file_name = '{0}'.format(name)
        extended_name = '__{0}__'.format(admonition_name)
    return template('page',
                    type="view",
                    name=display_file_name,
                    extended_name=extended_name,
                    is_repo=check_repo(),
                    history=[],
                    gitref=None,
                    content=doc2_pub.writer.parts['html_body'])