', '', content, flags = re.DOTALL);
content = re.sub(r'', '', content, flags = re.DOTALL);
# Don't need this attribute in our CHM
content = re.sub(r' rel="nofollow"', '', content);
section = re.match(r'(.+)/', title(p))
section_str = ''
if section:
section_str = section.group(1)
content = """
OpenMPT Manual - """ + title(p) + """
""" + title(p) + '
' + content + '
'
saved = open('html/' + destname(p), 'wb')
saved.write(bytes(content, 'UTF-8'))
saved.close()
project.write(destname(p)+"\n")
print(p)
project.close()
# Create TOC
toc = open('html/OpenMPT Manual.hhc', 'w')
toc.write("""
""")
def toc_parse(m):
return """"""
def toc_parse_chapter(m):
return """"""
toc_text = re.sub(r'', '', toc_page, flags = re.DOTALL)
toc_text = re.sub(r'', '', toc_text, flags = re.DOTALL)
toc_text = re.sub(r'
', '', toc_text, flags = re.DOTALL)
toc_text = re.sub(r'(.+?)', toc_parse, toc_text)
toc_text = re.sub(r'([^<]+)$', toc_parse_chapter, toc_text, flags = re.MULTILINE)
toc.write(toc_text)
toc.write("""
""")
toc.close()
if(subprocess.call(['../../build/tools/htmlhelp/hhc.exe', '"html/OpenMPT Manual.hhp"']) != 1):
raise Exception("Something went wrong during manual creation!")
try:
os.remove('../../packageTemplate/html/OpenMPT Manual.chm')
except OSError:
pass
shutil.copy2('html/OpenMPT Manual.chm', '../../packageTemplate/')