diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/tools/doc_merge.py | 12 | ||||
-rwxr-xr-x | doc/tools/doc_status.py | 13 | ||||
-rw-r--r-- | doc/tools/makedoku.py | 15 | ||||
-rw-r--r-- | doc/tools/makehtml.py | 39 | ||||
-rw-r--r-- | doc/tools/makemd.py | 1 | ||||
-rw-r--r-- | doc/tools/makerst.py | 6 |
6 files changed, 19 insertions, 67 deletions
diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py index 747a870378..d9f7cc9daa 100644 --- a/doc/tools/doc_merge.py +++ b/doc/tools/doc_merge.py @@ -16,6 +16,7 @@ tab = 0 old_classes = {} + def write_string(_f, text, newline=True): for t in range(tab): _f.write("\t") @@ -23,6 +24,7 @@ def write_string(_f, text, newline=True): if (newline): _f.write("\n") + def escape(ret): ret = ret.replace("&", "&"); ret = ret.replace("<", ">"); @@ -36,6 +38,7 @@ def inc_tab(): global tab tab += 1 + def dec_tab(): global tab tab -= 1 @@ -43,12 +46,14 @@ def dec_tab(): write_string(f, '<?xml version="1.0" encoding="UTF-8" ?>') write_string(f, '<doc version="' + new_doc.attrib["version"] + '">') + def get_tag(node, name): tag = "" if (name in node.attrib): tag = ' ' + name + '="' + escape(node.attrib[name]) + '" ' return tag + def find_method_descr(old_class, name): methods = old_class.find("methods") @@ -61,6 +66,7 @@ def find_method_descr(old_class, name): return None + def find_signal_descr(old_class, name): signals = old_class.find("signals") @@ -73,6 +79,7 @@ def find_signal_descr(old_class, name): return None + def find_constant_descr(old_class, name): if (old_class == None): @@ -85,6 +92,7 @@ def find_constant_descr(old_class, name): return m.text return None + def write_class(c): class_name = c.attrib["name"] print("Parsing Class: " + class_name) @@ -93,7 +101,6 @@ def write_class(c): else: old_class = None - category = get_tag(c, "category") inherits = get_tag(c, "inherits") write_string(f, '<class name="' + class_name + '" ' + category + inherits + '>') @@ -106,7 +113,6 @@ def write_class(c): if (old_brief_descr != None): write_string(f, escape(old_brief_descr.text.strip())) - write_string(f, "</brief_description>") write_string(f, "<description>") @@ -207,5 +213,3 @@ for c in list(old_doc): for c in list(new_doc): write_class(c) write_string(f, '</doc>\n') - - diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index 4e108f352e..e05bcd63e7 100755 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -75,7 +75,6 @@ colors = { overall_progress_description_weigth = 10 - ################################################################################ # Utils # ################################################################################ @@ -85,6 +84,7 @@ def validate_tag(elem, tag): print('Tag mismatch, expected "' + tag + '", got ' + elem.tag) sys.exit(255) + def color(color, string): if flags['c']: color_format = '' @@ -95,16 +95,18 @@ def color(color, string): return string ansi_escape = re.compile(r'\x1b[^m]*m') + + def nonescape_len(s): return len(ansi_escape.sub('', s)) - ################################################################################ # Classes # ################################################################################ class ClassStatusProgress: + def __init__(self, described=0, total=0): self.described = described self.total = total @@ -146,6 +148,7 @@ class ClassStatusProgress: class ClassStatus: + def __init__(self, name=''): self.name = name self.has_brief_description = True @@ -239,7 +242,6 @@ class ClassStatus: return status - ################################################################################ # Arguments # ################################################################################ @@ -304,7 +306,6 @@ if len(input_file_list) < 1 or flags['h']: sys.exit(0) - ################################################################################ # Parse class list # ################################################################################ @@ -334,7 +335,6 @@ if len(input_class_list) < 1: input_class_list = class_names - ################################################################################ # Make output table # ################################################################################ @@ -374,8 +374,6 @@ for cn in input_class_list: table.append(row) - - ################################################################################ # Print output table # ################################################################################ @@ -427,4 +425,3 @@ print(divider_string) if total_status.is_ok() and not flags['g']: print('All listed classes are ' + color('part_good', 'OK') + '!') - diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py index 32a52a584a..49a960c43a 100644 --- a/doc/tools/makedoku.py +++ b/doc/tools/makedoku.py @@ -53,14 +53,12 @@ def make_class_list(class_list, columns): indexers += [n] last_initial = n[:1] - row_max = 0 for n in range(0, columns): if (len(fit_columns[n]) > row_max): row_max = len(fit_columns[n]) - for r in range(0, row_max): s = "|" for c in range(0, columns): @@ -139,7 +137,6 @@ def dokuize_text(text): else: tag_text = "[" + tag_text + "]" - text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) @@ -173,8 +170,6 @@ def make_method(f, name, m, declare, event=False): mdata["argidx"].append(idx) mdata[idx] = a - - if (not event): if (-1 in mdata["argidx"]): s += make_type(mdata[-1].attrib["type"]) @@ -212,7 +207,6 @@ def make_method(f, name, m, declare, event=False): if ("default" in arg.attrib): s += "=" + arg.attrib["default"] - argfound = True if (argfound): @@ -270,8 +264,6 @@ def make_doku_class(node): s += " - " + c.text.strip() f.write(s + "\n") - - constants = node.find("constants") if(constants != None and len(list(constants)) > 0): f.write("===== Numeric Constants ======\n") @@ -284,7 +276,6 @@ def make_doku_class(node): s += " - " + c.text.strip() f.write(s + "\n") - descr = node.find("description") if (descr != None and descr.text.strip() != ""): f.write("===== Description ======\n") @@ -305,10 +296,6 @@ def make_doku_class(node): f.write(dokuize_text(d.text.strip())) f.write("\n") - - - - """ div=ET.Element("div") div.attrib["class"]="class"; @@ -510,5 +497,3 @@ make_class_list(class_names, 4) for cn in class_names: c = classes[cn] make_doku_class(c) - - diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py index 95a35960b7..369f559f25 100644 --- a/doc/tools/makehtml.py +++ b/doc/tools/makehtml.py @@ -12,9 +12,11 @@ html_escape_table = { html_unescape_table = {v: k for k, v in html_escape_table.items()} + def html_escape(text): return escape(text, html_escape_table) + def html_unescape(text): return unescape(text, html_unescape_table) @@ -41,12 +43,14 @@ def validate_tag(elem, tag): print("Tag mismatch, expected '" + tag + "', got " + elem.tag); sys.exit(255) + def make_html_bottom(body): # make_html_top(body,True) ET.SubElement(body, "hr") copyright = ET.SubElement(body, "span") copyright.text = "Copyright 2008-2010 Codenix SRL" + def make_html_top(body, bottom=False): if (bottom): @@ -83,8 +87,6 @@ def make_html_top(body, bottom=False): ET.SubElement(body, "hr") - - def make_html_class_list(class_list, columns): div = ET.Element("div") @@ -128,7 +130,6 @@ def make_html_class_list(class_list, columns): if (len(fit_columns[n]) > row_max): row_max = len(fit_columns[n]) - for r in range(0, row_max): tr = ET.SubElement(table, "tr") for c in range(0, columns): @@ -155,7 +156,6 @@ def make_html_class_list(class_list, columns): a.attrib["href"] = link a.text = classname - if (not single_page): cat_class_list = ET.Element("html") csscc = ET.SubElement(cat_class_list, "link") @@ -169,9 +169,6 @@ def make_html_class_list(class_list, columns): else: cat_class_parent = div - - - h1 = ET.SubElement(cat_class_parent, "h2") h1.text = "Class List By Category" @@ -227,7 +224,6 @@ def make_html_class_list(class_list, columns): catet_out = ET.ElementTree(cat_class_list) catet_out.write("category.html") - if (not single_page): inh_class_list = ET.Element("html") cssic = ET.SubElement(inh_class_list, "link") @@ -240,9 +236,6 @@ def make_html_class_list(class_list, columns): else: inh_class_parent = div - - - h1 = ET.SubElement(inh_class_parent, "h2") h1.text = "Class List By Inheritance" @@ -268,7 +261,6 @@ def make_html_class_list(class_list, columns): else: parent_list = parent_list.find("list") - else: parent_list = itemlist @@ -277,7 +269,6 @@ def make_html_class_list(class_list, columns): class_inh_table[clss.attrib["name"]] = item make_type(clss.attrib["name"], item) - for c in class_list: add_class(classes[c]) @@ -286,10 +277,6 @@ def make_html_class_list(class_list, columns): catet_out = ET.ElementTree(inh_class_list) catet_out.write("inheritance.html") - - - - # h1=ET.SubElement(div,"h2") #h1.text="Class List By Inheritance" @@ -314,7 +301,6 @@ def make_type(p_type, p_parent): span.text = p_type + " " - def make_text_def(class_name, parent, text): text = html_escape(text) pos = 0 @@ -370,7 +356,6 @@ def make_text_def(class_name, parent, text): else: tag_text = "[" + tag_text + "]" - text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) @@ -384,17 +369,13 @@ def make_text_def(class_name, parent, text): print("Error parsing description text: '" + text + "'") sys.exit(255) - return tnode - - def make_method_def(name, m, declare, event=False): mdata = {} - if (not declare): div = ET.Element("tr") div.attrib["class"] = "method" @@ -457,7 +438,6 @@ def make_method_def(name, m, declare, event=False): span = ET.SubElement(func_parent, "span") span.text = " " - make_type(arg.attrib["type"], func_parent) span = ET.SubElement(func_parent, "span") @@ -465,7 +445,6 @@ def make_method_def(name, m, declare, event=False): if ("default" in arg.attrib): span.text = span.text + "=" + arg.attrib["default"] - span = ET.SubElement(func_parent, "span") span.attrib["class"] = "symbol" if (len(mdata["argidx"])): @@ -533,7 +512,6 @@ def make_html_class(node): else: a.attrib["href"] = "category.html#" + catname - methods = node.find("methods") if(methods != None and len(list(methods)) > 0): @@ -561,7 +539,6 @@ def make_html_class(node): #li = ET.SubElement(div2, "li") event_table.append(make_method_def(node.attrib["name"], m, False, True)) - members = node.find("members") if(members != None and len(list(members)) > 0): @@ -583,7 +560,6 @@ def make_html_class(node): span.attrib["class"] = "member_description" span.text = c.text - constants = node.find("constants") if(constants != None and len(list(constants)) > 0): @@ -613,7 +589,6 @@ def make_html_class(node): # ET.SubElement(div,"br") - descr = node.find("description") if (descr != None and descr.text.strip() != ""): h4 = ET.SubElement(div, "h4") @@ -624,8 +599,6 @@ def make_html_class(node): # div2.attrib["class"]="description"; # div2.text=descr.text - - if(methods != None or events != None): h4 = ET.SubElement(div, "h4") @@ -646,7 +619,6 @@ def make_html_class(node): div2 = ET.SubElement(div, "div") div2.attrib["class"] = "method_doc"; - div2.append(make_method_def(node.attrib["name"], m, True)) #anchor = ET.SubElement(div2, "a") # anchor.attrib["name"] = @@ -655,7 +627,6 @@ def make_html_class(node): # div3.attrib["class"]="description"; # div3.text=descr.text - return div class_names = [] @@ -688,7 +659,6 @@ if (not single_page): make_html_top(body) - class_names.sort() body.append(make_html_class_list(class_names, 5)) @@ -717,4 +687,3 @@ if (single_page): else: make_html_bottom(body) et_out.write("alphabetical.html") - diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py index 0693291f35..bd0d4c6819 100644 --- a/doc/tools/makemd.py +++ b/doc/tools/makemd.py @@ -343,4 +343,3 @@ make_class_list(class_names, 2) for cn in class_names: c = classes[cn] make_doku_class(c) - diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 2f3b9c269d..6b6780ce1e 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -24,6 +24,7 @@ def validate_tag(elem, tag): class_names = [] classes = {} + def ul_string(str, ul): str += "\n" for i in range(len(str) - 1): @@ -31,6 +32,7 @@ def ul_string(str, ul): str += "\n" return str + def make_class_list(class_list, columns): f = codecs.open('class_list.rst', 'wb', 'utf-8') @@ -343,7 +345,6 @@ def make_heading(title, underline): return title + '\n' + underline * len(title) + "\n\n" - def make_rst_class(node): name = node.attrib['name'] @@ -375,7 +376,6 @@ def make_rst_class(node): else: inh = None - f.write("\n\n") inherited = [] @@ -436,7 +436,6 @@ def make_rst_class(node): f.write(sep) f.write('\n') - events = node.find('signals') if events != None and len(list(events)) > 0: f.write(make_heading('Signals', '-')) @@ -516,4 +515,3 @@ class_names.sort() for cn in class_names: c = classes[cn] make_rst_class(c) - |