def write_out_page(self, output, page):
subpages = OrderedDict({})<EOL>all_pages = self.project.tree.get_pages()<EOL>subpage_names = self.get_subpages_sorted(all_pages, page)<EOL>for pagename in subpage_names:<EOL><INDENT>proj = self.project.subprojects.get(pagename)<EOL>if not proj:<EOL><INDENT>cpage = all_pages[pagename]<EOL>sub_formatter = self.project.extensions[<EOL>cpage.extension_name].formatter<EOL><DEDENT>else:<EOL><INDENT>cpage = proj.tree.root<EOL>sub_formatter = proj.extensions[cpage.extension_name].formatter<EOL><DEDENT>subpage_link, _ = cpage.link.get_link(self.app.link_resolver)<EOL>prefix = sub_formatter.get_output_folder(cpage)<EOL>if prefix:<EOL><INDENT>subpage_link = '<STR_LIT>' % (prefix, subpage_link)<EOL><DEDENT>subpages[subpage_link] = cpage<EOL><DEDENT>html_subpages = self.formatter.format_subpages(page, subpages)<EOL>js_dir = os.path.join(output, '<STR_LIT:html>', '<STR_LIT>', '<STR_LIT>')<EOL>if not os.path.exists(js_dir):<EOL><INDENT>os.makedirs(js_dir)<EOL><DEDENT>sm_path = os.path.join(js_dir, '<STR_LIT>')<EOL>self.write_out_sitemap(sm_path)<EOL>self.formatter.write_out(page, html_subpages, output)<EOL>
Banana banana