######################################################################## ## ## Win32 Usage: makepanda\makechm.bat ## Linux Usage: makepanda/makechm.py ## ## To use this script, you will need to have hhc.exe on your system. ## For verbose output, run with -v or --verbose option. ## To keep the temporary .hhc, .hhk, .hhp, .chw files use -k or --keep. ## ## You can also import this file as a python module. You will then have ## access to three functions: makeCHM, makeManualCHM, makeReferenceCHM. ## This is how you call them: ## makeCHM(outputfile, dirname, title) ## where outputfile is the filename where the .chm file will be written, ## and dirname is the directory containing the html files to include. ## Title will be the title of the CHM file. ## The functions makeManualCHM and makeReferenceCHM work exactly the ## same, except that they work with a structure resembling that of the ## Panda3D manual and reference, respectively. ## Note: outputfile should not contain spaces. ## ######################################################################## __all__ = ["makeCHM", "makeManualCHM", "makeReferenceCHM"] import os, re from sys import exit import xml.dom.minidom from xml.dom.minidom import Node VERBOSE = False KEEPTEMP = False if __name__ == "__main__": from sys import argv VERBOSE = ("-v" in argv) or ("-vk" in argv) or ("-kv" in argv) or ("--verbose" in argv) KEEPTEMP = ("-k" in argv) or ("-kv" in argv) or ("-vk" in argv) or ("--keep" in argv) OPTIONBLOCK = """ Binary TOC=Yes Compatibility=1.1 or later Compiled file=%s Contents file=%s.hhc Default Font=Arial,10,0 Default topic=%s Display compile progress=VERBOSE Full-text search=Yes Index file=%s.hhk Language=0x409 English (United States) Title=%s""".replace("VERBOSE", VERBOSE and "Yes" or "No") HTMLBLOCK = """