def write_out(self, page, xml_subpages, output):
<EOL>def subpages(_):<EOL><INDENT>return xml_subpages<EOL><DEDENT>namespace = etree.FunctionNamespace('<STR_LIT>')<EOL>namespace['<STR_LIT>'] = subpages<EOL>html_output = os.path.join(output, '<STR_LIT:html>')<EOL>rel_path = os.path.join(self.get_output_folder(page), page.link.ref)<EOL>cached_path = os.path.join(self.__cache_dir, rel_path)<EOL>full_path = os.path.join(html_output, rel_path)<EOL>if not os.path.exists(os.path.dirname(full_path)):<EOL><INDENT>os.makedirs(os.path.dirname(full_path))<EOL><DEDENT>with open(cached_path, '<STR_LIT:r>', encoding='<STR_LIT:utf-8>') as _:<EOL><INDENT>doc_root = etree.HTML(_.read())<EOL><DEDENT>self.__validate_html(self.extension.project, page, doc_root)<EOL>self.writing_page_signal(self, page, full_path, doc_root)<EOL>with open(full_path, '<STR_LIT:w>', encoding='<STR_LIT:utf-8>') as _:<EOL><INDENT>transformed = str(self.__page_transform(doc_root))<EOL>_.write('<STR_LIT>' % transformed)<EOL><DEDENT>
Banana banana