def wp_stat(config_agent, tpl_render, req_path): view_settings = get_view_settings(config_agent) view_settings["show_quick_links"] = False view_settings["show_toolbox"] = False static_files = static_file.get_global_static_files(**view_settings) title = "Stat" stat_tpl = """# Stat || _ || _ || | Wiki pages | %d | | Folder | %d | """ folder_page_full_path = config_agent.get_full_path("paths", "pages_path") page_count = ( commons.run(" cd %s ; find . -type f -name '*.md' -or -name '*.markdown' | wc -l " % folder_page_full_path) or 0 ) folder_count = commons.run(" cd %s ; find . -type d | wc -l " % folder_page_full_path) or 0 text = stat_tpl % (int(page_count), int(folder_count)) content = mdutils.md2html(config_agent=config_agent, req_path=req_path, text=text) return tpl_render.canvas( config=config_agent.config, static_files=static_files, button_path=None, req_path=req_path, title=title, content=content, **view_settings )
def wp_stat(): stat_tpl = """# Stat || _ || _ || | Wiki pages | %d | | Folder | %d | """ page_count = commons.run(" cd %s ; find . -type f -name '*.md' | wc -l " % conf.pages_path) or 0 folder_count = commons.run(" cd %s ; find . -type d | wc -l " % conf.pages_path) or 0 text = stat_tpl % (int(page_count), int(folder_count)) content = commons.md2html(text) return tpl_render.canvas(conf, button_path = None, content = content, req_path = None, static_files = g_global_static_files, show_quick_links = False)