def _add_redirects(self):
html = '''<STR_LIT>'''<EOL>with open(REDIRECTS_FILE) as mapping_fd:<EOL><INDENT>reader = csv.reader(mapping_fd)<EOL>for row in reader:<EOL><INDENT>if not row or row[<NUM_LIT:0>].strip().startswith('<STR_LIT:#>'):<EOL><INDENT>continue<EOL><DEDENT>path = os.path.join(BUILD_PATH,<EOL>'<STR_LIT:html>',<EOL>*row[<NUM_LIT:0>].split('<STR_LIT:/>')) + '<STR_LIT>'<EOL>try:<EOL><INDENT>title = self._get_page_title(row[<NUM_LIT:1>])<EOL><DEDENT>except Exception:<EOL><INDENT>title = '<STR_LIT>'<EOL><DEDENT>if os.path.exists(path):<EOL><INDENT>raise RuntimeError((<EOL>'<STR_LIT>'<EOL>'<STR_LIT:{}>').format(path))<EOL><DEDENT>with open(path, '<STR_LIT:w>') as moved_page_fd:<EOL><INDENT>moved_page_fd.write(<EOL>html.format(url='<STR_LIT>'.format(row[<NUM_LIT:1>]),<EOL>title=title))<EOL><DEDENT><DEDENT><DEDENT>
Create in the build directory an html file with a redirect,
for every row in REDIRECTS_FILE.