write_rst_file(
        index_path,
        'impact_functions_doc',
        content_rst)


if __name__ == "__main__":
    # remove old files, in case you disabled or remove impact function
    documentation_path = (
        os.path.join(get_inasafe_documentation_path(), doc_dir,
                     impact_func_doc_dir))

    if os.path.exists(documentation_path):
        rmtree(documentation_path)

    metadata = {}
    doc_strings = {}
    # Get all impact functions
    plugins_dict = get_plugins()
    for myKey, myFunc in plugins_dict.iteritems():
        if not is_function_enabled(myFunc):
            continue
        metadata[myKey] = get_metadata(myKey)
        doc_strings[myKey] = get_doc_string(myFunc)
    function_ids = [x['unique_identifier']
                    for x in metadata.values()]
    create_index(function_ids)

    create_dirs(documentation_path)
    generate_documentation(metadata, doc_strings)
Esempio n. 2
0
    else:
        inasafe_doc_path = None

    # remove old files, in case you disabled or remove impact function
    documentation_path = (os.path.join(
        get_inasafe_documentation_path(inasafe_doc_path), doc_dir,
        impact_func_doc_dir))

    if os.path.exists(documentation_path):
        rmtree(documentation_path)

    metadata = {}
    doc_strings = {}
    # Get all impact functions
    plugins_dict = get_plugins()
    for key, impact_function in plugins_dict.iteritems():
        if not is_function_enabled(impact_function):
            continue
        metadata[key] = get_metadata(key)
        doc_strings[key] = get_doc_string(impact_function)
    function_ids = [x['unique_identifier'] for x in metadata.values()]
    print 'Generating index page for Impact Functions Documentation'
    create_index(function_ids)

    create_dirs(documentation_path)

    print 'Generating page for Impact Functions'
    generate_documentation(metadata, doc_strings)

    print 'Fin.'
        inasafe_doc_path = None

    # remove old files, in case you disabled or remove impact function
    documentation_path = (
        os.path.join(
            get_inasafe_documentation_path(
                inasafe_doc_path), doc_dir, impact_func_doc_dir))

    if os.path.exists(documentation_path):
        rmtree(documentation_path)

    metadata = {}
    doc_strings = {}
    # Get all impact functions
    plugins_dict = get_plugins()
    for key, impact_function in plugins_dict.iteritems():
        if not is_function_enabled(impact_function):
            continue
        metadata[key] = get_metadata(key)
        doc_strings[key] = get_doc_string(impact_function)
    function_ids = [x['unique_identifier'] for x in metadata.values()]
    print 'Generating index page for Impact Functions Documentation'
    create_index(function_ids)

    create_dirs(documentation_path)

    print 'Generating page for Impact Functions'
    generate_documentation(metadata, doc_strings)

    print 'Fin.'
        content_rst += (
            '   %s%s%s\n' %
            (impact_func_doc_dir, os.sep, identifier.replace(' ', '')))

    index_path = os.path.join(get_inasafe_documentation_path(), doc_dir)
    write_rst_file(index_path, 'impact_functions_doc', content_rst)


if __name__ == "__main__":
    # remove old files, in case you disabled or remove impact function
    documentation_path = (os.path.join(get_inasafe_documentation_path(),
                                       doc_dir, impact_func_doc_dir))

    if os.path.exists(documentation_path):
        rmtree(documentation_path)

    metadata = {}
    doc_strings = {}
    # Get all impact functions
    plugins_dict = get_plugins()
    for myKey, myFunc in plugins_dict.iteritems():
        if not is_function_enabled(myFunc):
            continue
        metadata[myKey] = get_metadata(myKey)
        doc_strings[myKey] = get_doc_string(myFunc)
    function_ids = [x['unique_identifier'] for x in metadata.values()]
    create_index(function_ids)

    create_dirs(documentation_path)
    generate_documentation(metadata, doc_strings)