diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-10-14 15:13:21 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-10-14 15:22:06 +0200 |
commit | deefc2a63d36b6659630df703a9b98adffb893e9 (patch) | |
tree | 759b4cf055bf289c7e096ffadb622e83ebdcc038 | |
parent | e82a3f0168de499c86a62a4b8699da2b18e95195 (diff) |
makerst: Fix support for module classes
Previous code expected only one XML per module, which is not the case for
e.g. mono or gdnative.
Also add newline after signal description to fix rst warning, and make the
script Python 3-compatible.
[ci skip]
-rw-r--r-- | doc/Makefile | 2 | ||||
-rw-r--r-- | doc/tools/makerst.py | 20 |
2 files changed, 9 insertions, 13 deletions
diff --git a/doc/Makefile b/doc/Makefile index d68c66f8eb..2f9fefe794 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -24,5 +24,5 @@ rst: rm -rf $(OUTPUTDIR)/rst mkdir -p $(OUTPUTDIR)/rst pushd $(OUTPUTDIR)/rst - python2 $(TOOLSDIR)/makerst.py $(CLASSES) + python $(TOOLSDIR)/makerst.py $(CLASSES) popd diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index c4dff588b0..0c67e3be4c 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -14,14 +14,14 @@ for arg in sys.argv[1:]: input_list.append(arg) if len(input_list) < 1: - print 'usage: makerst.py <path to folders> and/or <path to .xml files> (order of arguments irrelevant)' - print 'example: makerst.py "../../modules/" "../classes" path_to/some_class.xml' + print('usage: makerst.py <path to folders> and/or <path to .xml files> (order of arguments irrelevant)') + print('example: makerst.py "../../modules/" "../classes" path_to/some_class.xml') sys.exit(0) def validate_tag(elem, tag): if elem.tag != tag: - print "Tag mismatch, expected '" + tag + "', got " + elem.tag + print("Tag mismatch, expected '" + tag + "', got " + elem.tag) sys.exit(255) @@ -41,7 +41,7 @@ def make_class_list(class_list, columns): f = codecs.open('class_list.rst', 'wb', 'utf-8') prev = 0 col_max = len(class_list) / columns + 1 - print ('col max is ', col_max) + print(('col max is ', col_max)) col_count = 0 row_count = 0 last_initial = '' @@ -300,11 +300,6 @@ def make_method( if declare or pp == None: - # span.attrib["class"]="funcdecl" - # a=ET.SubElement(span,"a") - # a.attrib["name"]=name+"_"+m.attrib["name"] - # a.text=name+"::"+m.attrib["name"] - s = ' **' + m.attrib['name'] + '** ' else: s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + m.attrib['name'] + '>` ' @@ -446,6 +441,7 @@ def make_rst_class(node): f.write(make_heading('Signals', '-')) for m in list(events): make_method(f, node.attrib['name'], m, True, name, True) + f.write('\n') d = m.find('description') if d == None or d.text.strip() == '': continue @@ -507,8 +503,8 @@ for path in input_list: for subdir, dirs, _ in os.walk(path): if 'doc_classes' in dirs: doc_dir = os.path.join(subdir, 'doc_classes') - class_file_name = [f for f in os.listdir(doc_dir) if f.endswith('.xml')][0] - file_list.append(os.path.join(doc_dir, class_file_name)) + class_file_names = [f for f in os.listdir(doc_dir) if f.endswith('.xml')] + file_list += [os.path.join(doc_dir, f) for f in class_file_names] elif not os.path.isfile(path): file_list += [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xml')] elif os.path.isfile(path) and path.endswith('.xml'): @@ -519,7 +515,7 @@ for file in file_list: doc = tree.getroot() if 'version' not in doc.attrib: - print "Version missing from 'doc'" + print("Version missing from 'doc'") sys.exit(255) version = doc.attrib['version'] |