Changeset 98678 in vbox for trunk/doc/manual/htmlhelp-qthelp.py
- Timestamp:
- Feb 21, 2023 3:39:02 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/htmlhelp-qthelp.py
r98103 r98678 17 17 else: 18 18 from HTMLParser import HTMLParser 19 19 20 20 21 … … 91 92 return image_files_list 92 93 93 # open htmlhelp.hhp filesand read the list of html files from there94 def create_html_list(folder ):94 # open files list and read the list of html files from there 95 def create_html_list(folder, list_file): 95 96 global html_files 96 file_name = 'htmlhelp.hhp'97 97 html_file_lines = [] 98 if not file_name in os.listdir(folder):99 logging.error('Could not find the file "%s" in "%s"', file_name, folder)98 if not list_file in os.listdir(folder): 99 logging.error('Could not find the file "%s" in "%s"', list_file, folder) 100 100 return html_file_lines 101 full_path = os.path.join(folder, 'htmlhelp.hhp')101 full_path = os.path.join(folder, list_file) 102 102 file = codecs.open(full_path, encoding='iso-8859-1') 103 103 … … 118 118 119 119 120 def create_files_section(folder ):120 def create_files_section(folder, list_file): 121 121 files_section_lines = ['<files>'] 122 122 files_section_lines += create_image_list(folder) 123 files_section_lines += create_html_list(folder )123 files_section_lines += create_html_list(folder, list_file) 124 124 files_section_lines.append('</files>') 125 125 return files_section_lines … … 188 188 return result 189 189 190 # parse toc.hhcfile. assuming all the relevant information190 # parse TOC file. assuming all the relevant information 191 191 # is stored in tags and attributes. whatever is outside of 192 192 # <... > pairs is filtered out. we also assume < ..> are not nested 193 193 # and each < matches to a > 194 def create_toc(folder ):195 toc_ file = 'toc.hhc'194 def create_toc(folder, toc_file): 195 toc_string_list = [] 196 196 content = [x[2] for x in os.walk(folder)] 197 197 if toc_file not in content[0]: … … 219 219 # content = re.sub(r'>.*?<', r'>\n<', content) 220 220 # lines = content.split('\n') 221 toc_string_list = ['<toc>']221 toc_string_list.append('<toc>') 222 222 index = 0 223 223 for tag in tag_list: … … 238 238 helphtmlfolder = '' 239 239 output_filename = '' 240 list_file = '' 241 toc_file = '' 240 242 try: 241 opts, args = getopt.getopt(sys.argv[1:],"hd:o: ")243 opts, args = getopt.getopt(sys.argv[1:],"hd:o:f:t:") 242 244 except getopt.GetoptError as err: 243 245 print(err) … … 248 250 elif opt in ("-d"): 249 251 helphtmlfolder = arg 252 print(helphtmlfolder) 253 elif opt in ("-f"): 254 list_file = arg 255 elif opt in ("-t"): 256 toc_file = arg 257 print(toc_file) 250 258 elif opt in ("-o"): 251 259 output_filename = arg … … 270 278 '<virtualFolder>doc</virtualFolder>', \ 271 279 '<filterSection>'] 272 out_xml_lines += create_toc(helphtmlfolder ) + create_files_section(helphtmlfolder)280 out_xml_lines += create_toc(helphtmlfolder, toc_file) + create_files_section(helphtmlfolder, list_file) 273 281 out_xml_lines += create_keywords_section(helphtmlfolder) 274 282 out_xml_lines += ['</filterSection>', '</QtHelpProject>']
Note:
See TracChangeset
for help on using the changeset viewer.