MCPcopy Create free account
hub / github.com/apache/cloudstack / write_xml

Function write_xml

tools/apidoc/gen_toc.py:344–378  ·  view source on GitHub ↗
(out, user)

Source from the content-addressed store, hash-verified

342
343
344def 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(''&#x27;<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''&#x27; % 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
381def java_for(command, user):

Callers 1

gen_toc.pyFile · 0.85

Calls 6

xml_forFunction · 0.85
keysMethod · 0.80
sortMethod · 0.65
writeMethod · 0.65
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected