commit
ba0ec2ffd2
1 changed files with 13 additions and 8 deletions
|
@ -2,12 +2,19 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import os.path as path
|
||||||
|
import os
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
input_list = []
|
input_list = []
|
||||||
|
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
input_list.append(arg)
|
if not path.exists(arg):
|
||||||
|
exit("path {} doesn't exist".format(arg))
|
||||||
|
elif path.isdir(arg):
|
||||||
|
input_list += filter(path.isfile, [path.join(arg, f) for f in os.listdir(arg)])
|
||||||
|
else: # assuming is a file
|
||||||
|
input_list.append(arg)
|
||||||
|
|
||||||
if len(input_list) < 1:
|
if len(input_list) < 1:
|
||||||
print 'usage: makemd.py <classes.xml>'
|
print 'usage: makemd.py <classes.xml>'
|
||||||
|
@ -29,7 +36,6 @@ def make_class_list(class_list, columns):
|
||||||
f = open('class_list.md', 'wb')
|
f = open('class_list.md', 'wb')
|
||||||
prev = 0
|
prev = 0
|
||||||
col_max = len(class_list) / columns + 1
|
col_max = len(class_list) / columns + 1
|
||||||
print ('col max is ', col_max)
|
|
||||||
col_count = 0
|
col_count = 0
|
||||||
row_count = 0
|
row_count = 0
|
||||||
last_initial = ''
|
last_initial = ''
|
||||||
|
@ -335,12 +341,11 @@ for file in input_list:
|
||||||
sys.exit(255)
|
sys.exit(255)
|
||||||
|
|
||||||
version = doc.attrib['version']
|
version = doc.attrib['version']
|
||||||
|
class_name = doc.attrib['name']
|
||||||
for c in list(doc):
|
if class_name in class_names:
|
||||||
if c.attrib['name'] in class_names:
|
continue
|
||||||
continue
|
class_names.append(class_name)
|
||||||
class_names.append(c.attrib['name'])
|
classes[class_name] = doc
|
||||||
classes[c.attrib['name']] = c
|
|
||||||
|
|
||||||
class_names.sort()
|
class_names.sort()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue