| 342 | |
| 343 | |
| 344 | def write_xml(out, user): |
| 345 | with open(out, 'w') as f: |
| 346 | cat_strings = [] |
| 347 | for category in categories.keys(): |
| 348 | strings = [] |
| 349 | for command in categories[category]: |
| 350 | if command['user'] == user: |
| 351 | strings.append(xml_for(command)) |
| 352 | if strings: |
| 353 | all_strings = ''.join(strings) |
| 354 | cat_strings.append((len(strings), category, all_strings)) |
| 355 | |
| 356 | cat_strings.sort(reverse=True) |
| 357 | |
| 358 | i = 0 |
| 359 | for _1, category, all_strings in cat_strings: |
| 360 | if i == 0: |
| 361 | f.write('<div class="apismallsections">\n') |
| 362 | f.write('''<div class="apismallbullet_box"> |
| 363 | <h5>%(category)s</h5> |
| 364 | <ul> |
| 365 | <xsl:for-each select="commands/command"> |
| 366 | %(all_strings)s |
| 367 | </xsl:for-each> |
| 368 | </ul> |
| 369 | </div> |
| 370 | |
| 371 | ''' % locals()) |
| 372 | if i == 3: |
| 373 | f.write('</div>\n') |
| 374 | i = 0 |
| 375 | else: |
| 376 | i += 1 |
| 377 | if i != 0: |
| 378 | f.write('</div>\n') |
| 379 | |
| 380 | |
| 381 | def java_for(command, user): |