diff options
Diffstat (limited to 'doc/tools/doc_merge.py')
-rw-r--r-- | doc/tools/doc_merge.py | 12 |
1 files changed, 8 insertions, 4 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') - - |