content_rst += ' ' + impact_func_doc_dir + os.sep + \ ui.replace(' ', '') + '\n' write_rst_file(os.path.join(insafe_dir_path, doc_dir), 'impact_functions_doc', content_rst) if __name__ == "__main__": # remove old files, in case you disabled or remove impact function impact_func_doc_dir_path = (os.path.join(insafe_dir_path, doc_dir, impact_func_doc_dir)) if os.path.exists(impact_func_doc_dir_path): rmtree(impact_func_doc_dir_path) impfunc_doc = {} impfunc_doc_str = {} # Get all impact functions plugins_dict = get_plugins() for myKey, myFunc in plugins_dict.iteritems(): if not is_function_enabled(myFunc): continue impfunc_doc[myKey] = get_documentation(myKey) impfunc_doc_str[myKey] = get_doc_string(myFunc) list_unique_identifier = [x['unique_identifier'] for x in impfunc_doc.values()] gen_impact_func_index(list_unique_identifier) create_dirs(impact_func_doc_dir_path) gen_rst_doc(impfunc_doc, impfunc_doc_str)
# list impact function for ui in list_unique_identifier: content_rst += ' ' + impact_func_doc_dir + os.sep + \ ui.replace(' ', '') + '\n' create_rst_file(insafe_dir_path + os.sep + doc_dir, 'impact_functions_doc', content_rst) if __name__ == "__main__": # remove old files, in case you disabled or remove impact function impact_func_doc_dir_path = (insafe_dir_path + os.sep + doc_dir + os.sep + impact_func_doc_dir) if os.path.exists(impact_func_doc_dir_path): rmtree(impact_func_doc_dir_path) impfunc_doc = {} # Get all impact functions plugins_dict = get_plugins() for myKey, myFunc in plugins_dict.iteritems(): if not is_function_enabled(myFunc): continue impfunc_doc[myKey] = get_documentation(myKey) list_unique_identifier = [ x['unique_identifier'] for x in impfunc_doc.itervalues() ] gen_impact_func_index(list_unique_identifier) create_dirs(impact_func_doc_dir_path) gen_rst_doc(impfunc_doc)
content_rst += title_page + "\n" content_rst += "=" * len(title_page) + "\n\n" content_rst += ( "This document explains the purpose of impact functions " "and lists the different available impact function and " "the requirements each has to be used effectively.\n\n" ) content_rst += ".. toctree::\n" content_rst += " :maxdepth: 2\n\n" # list impact function for ui in list_unique_identifier: content_rst += " " + impact_func_doc_dir + os.sep + ui.replace(" ", "") + "\n" create_rst_file(insafe_dir_path + os.sep + doc_dir, "impact_functions_doc", content_rst) if __name__ == "__main__": impfunc_doc = {} # Get all impact functions plugins_dict = get_plugins() for k in plugins_dict.keys(): impfunc_doc[k] = get_documentation(k) list_unique_identifier = [x["unique_identifier"] for x in impfunc_doc.itervalues()] gen_impact_func_index(list_unique_identifier) create_dirs(insafe_dir_path + os.sep + doc_dir + os.sep + impact_func_doc_dir) gen_rst_doc(impfunc_doc)