3 # Generate an on-line help file for SST 2K from the text generated from
4 # the XML documentation.
6 # By Eric S. Raymond for the Super Star Trek project
9 enddelim = "********\n"
11 # This is the part most likely to bit-rot
12 beginmarker1 = "Mnemonic:"
13 endmarker1 = "Miscellaneous Notes"
14 beginmarker2 = " ABBREV"
15 endmarker2 = "Game History and Modifications"
17 fp = open("sst-doc.txt", "r")
24 if state == 0 and line.startswith(beginmarker1):
25 line = "% " + line[12:].lstrip()
27 if state == 0 and line.startswith(beginmarker2):
28 savetext.append(enddelim + "%% ABBREV\n")
31 if line.find(endmarker1) > -1:
34 if line.find(endmarker2) > -1:
37 line = line.replace("%", "%%")
38 # Hack Unicode non-breaking spaces into ordinary spaces
39 line = line.replace("\xc2\xa0", " ").replace("\240", "")
40 if line.startswith("Mnemonic:"):
41 while not savetext[-1].strip():
44 savetext = "".join(savetext)
46 # Remove the section titles
47 savetext = re.sub("\n+.*\n*Mnemonic:\\s*", "\n********\n%% ", savetext)
49 sys.stdout.write(savetext + enddelim)