summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-02-18 17:46:34 +0100
committerGitHub <noreply@github.com>2018-02-18 17:46:34 +0100
commitba0ec2ffd24c6d502c8f171281125b94353444d8 (patch)
treef00dba0bdcc189ba2d72f407bc8b9fe5bd249c0f /doc
parentbbd8f2c1b42fbf800ae4703c3c68c4faef114331 (diff)
parent059221f1230cf6563e2753bbf20a4c6763ff1d4d (diff)
Merge pull request #16792 from Yanpas/md_maker
fixed md script
Diffstat (limited to 'doc')
-rw-r--r--doc/tools/makemd.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py
index b2444eb47b..a73a4337d0 100644
--- a/doc/tools/makemd.py
+++ b/doc/tools/makemd.py
@@ -2,12 +2,19 @@
# -*- coding: utf-8 -*-
import sys
+import os.path as path
+import os
import xml.etree.ElementTree as ET
input_list = []
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:
print 'usage: makemd.py <classes.xml>'
@@ -29,7 +36,6 @@ def make_class_list(class_list, columns):
f = open('class_list.md', 'wb')
prev = 0
col_max = len(class_list) / columns + 1
- print ('col max is ', col_max)
col_count = 0
row_count = 0
last_initial = ''
@@ -335,12 +341,11 @@ for file in input_list:
sys.exit(255)
version = doc.attrib['version']
-
- for c in list(doc):
- if c.attrib['name'] in class_names:
- continue
- class_names.append(c.attrib['name'])
- classes[c.attrib['name']] = c
+ class_name = doc.attrib['name']
+ if class_name in class_names:
+ continue
+ class_names.append(class_name)
+ classes[class_name] = doc
class_names.sort()