2016-10-17 08:50:25 +02:00
|
|
|
#!/usr/bin/env python
|
2015-12-13 00:01:04 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
import sys
|
|
|
|
import xml.etree.ElementTree as ET
|
2015-11-18 12:33:29 +01:00
|
|
|
from xml.sax.saxutils import escape, unescape
|
|
|
|
|
|
|
|
html_escape_table = {
|
2016-11-02 22:26:55 +01:00
|
|
|
'"': """,
|
|
|
|
"'": "'"
|
2015-11-18 12:33:29 +01:00
|
|
|
}
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
html_unescape_table = {v: k for k, v in html_escape_table.items()}
|
2015-11-18 12:33:29 +01:00
|
|
|
|
2016-11-02 22:29:36 +01:00
|
|
|
|
2015-11-18 12:33:29 +01:00
|
|
|
def html_escape(text):
|
2016-11-02 22:26:55 +01:00
|
|
|
return escape(text, html_escape_table)
|
2015-11-18 12:33:29 +01:00
|
|
|
|
2016-11-02 22:29:36 +01:00
|
|
|
|
2015-11-18 12:33:29 +01:00
|
|
|
def html_unescape(text):
|
2016-11-02 22:26:55 +01:00
|
|
|
return unescape(text, html_unescape_table)
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
input_list = []
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
single_page = True
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
for arg in sys.argv[1:]:
|
2016-11-02 22:26:55 +01:00
|
|
|
if arg[:1] == "-":
|
|
|
|
if arg[1:] == "multipage":
|
|
|
|
single_page = False
|
|
|
|
if arg[1:] == "singlepage":
|
|
|
|
single_page = True
|
|
|
|
else:
|
|
|
|
input_list.append(arg)
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
if len(input_list) < 1:
|
2016-11-02 22:26:55 +01:00
|
|
|
print("usage: makehtml.py <classes.xml>")
|
|
|
|
sys.exit(0)
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
def validate_tag(elem, tag):
|
2016-11-02 22:26:55 +01:00
|
|
|
if (elem.tag != tag):
|
2016-11-02 22:30:34 +01:00
|
|
|
print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
|
2016-11-02 22:26:55 +01:00
|
|
|
sys.exit(255)
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:29:36 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
def make_html_bottom(body):
|
2016-11-02 22:28:28 +01:00
|
|
|
# make_html_top(body,True)
|
|
|
|
ET.SubElement(body, "hr")
|
|
|
|
copyright = ET.SubElement(body, "span")
|
2016-11-02 22:26:55 +01:00
|
|
|
copyright.text = "Copyright 2008-2010 Codenix SRL"
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:29:36 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
def make_html_top(body, bottom=False):
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
if (bottom):
|
2016-11-02 22:28:28 +01:00
|
|
|
ET.SubElement(body, "hr")
|
|
|
|
|
|
|
|
table = ET.SubElement(body, "table")
|
|
|
|
table.attrib["class"] = "top_table"
|
|
|
|
tr = ET.SubElement(table, "tr")
|
|
|
|
td = ET.SubElement(tr, "td")
|
|
|
|
td.attrib["class"] = "top_table"
|
|
|
|
|
|
|
|
img = ET.SubElement(td, "image")
|
|
|
|
img.attrib["src"] = "images/logo.png"
|
|
|
|
td = ET.SubElement(tr, "td")
|
|
|
|
td.attrib["class"] = "top_table"
|
|
|
|
a = ET.SubElement(td, "a")
|
|
|
|
a.attrib["href"] = "index.html"
|
|
|
|
a.text = "Index"
|
|
|
|
td = ET.SubElement(tr, "td")
|
|
|
|
td.attrib["class"] = "top_table"
|
|
|
|
a = ET.SubElement(td, "a")
|
|
|
|
a.attrib["href"] = "alphabetical.html"
|
|
|
|
a.text = "Classes"
|
|
|
|
td = ET.SubElement(tr, "td")
|
|
|
|
td.attrib["class"] = "top_table"
|
|
|
|
a = ET.SubElement(td, "a")
|
|
|
|
a.attrib["href"] = "category.html"
|
|
|
|
a.text = "Categories"
|
|
|
|
td = ET.SubElement(tr, "td")
|
|
|
|
a = ET.SubElement(td, "a")
|
|
|
|
a.attrib["href"] = "inheritance.html"
|
|
|
|
a.text = "Inheritance"
|
2016-11-02 22:26:55 +01:00
|
|
|
if (not bottom):
|
2016-11-02 22:28:28 +01:00
|
|
|
ET.SubElement(body, "hr")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
def make_html_class_list(class_list, columns):
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
div = ET.Element("div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div.attrib["class"] = "ClassList"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h1 = ET.SubElement(div, "h2")
|
|
|
|
h1.text = "Alphabetical Class List"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
table = ET.SubElement(div, "table")
|
|
|
|
table.attrib["class"] = "class_table"
|
|
|
|
table.attrib["width"] = "100%"
|
|
|
|
prev = 0
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
col_max = len(class_list) / columns + 1
|
|
|
|
print("col max is ", col_max)
|
|
|
|
col_count = 0
|
|
|
|
row_count = 0
|
|
|
|
last_initial = ""
|
2016-11-02 22:28:28 +01:00
|
|
|
fit_columns = []
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
for n in range(0, columns):
|
|
|
|
fit_columns += [[]]
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
indexers = []
|
|
|
|
last_initial = ""
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
idx = 0
|
2016-11-02 22:26:55 +01:00
|
|
|
for n in class_list:
|
2016-11-02 22:28:28 +01:00
|
|
|
col = int(idx / col_max)
|
|
|
|
if (col >= columns):
|
|
|
|
col = columns - 1
|
|
|
|
fit_columns[col] += [n]
|
|
|
|
idx += 1
|
|
|
|
if (n[:1] != last_initial):
|
|
|
|
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):
|
|
|
|
tr = ET.SubElement(table, "tr")
|
|
|
|
for c in range(0, columns):
|
|
|
|
tdi = ET.SubElement(tr, "td")
|
|
|
|
tdi.attrib["align"] = "right"
|
|
|
|
td = ET.SubElement(tr, "td")
|
|
|
|
if (r >= len(fit_columns[c])):
|
2016-11-02 22:26:55 +01:00
|
|
|
continue
|
|
|
|
|
|
|
|
classname = fit_columns[c][r]
|
|
|
|
print(classname)
|
|
|
|
if (classname in indexers):
|
|
|
|
|
|
|
|
span = ET.SubElement(tdi, "span")
|
|
|
|
span.attrib["class"] = "class_index_letter"
|
|
|
|
span.text = classname[:1].upper()
|
|
|
|
|
|
|
|
if (single_page):
|
2016-11-02 22:28:28 +01:00
|
|
|
link = "#" + classname
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
link = classname + ".html"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
a = ET.SubElement(td, "a")
|
|
|
|
a.attrib["href"] = link
|
|
|
|
a.text = classname
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
if (not single_page):
|
2016-11-02 22:28:28 +01:00
|
|
|
cat_class_list = ET.Element("html")
|
2016-11-02 22:26:55 +01:00
|
|
|
csscc = ET.SubElement(cat_class_list, "link")
|
|
|
|
csscc.attrib["href"] = "main.css"
|
|
|
|
csscc.attrib["rel"] = "stylesheet"
|
|
|
|
csscc.attrib["type"] = "text/css"
|
|
|
|
bodycc = ET.SubElement(cat_class_list, "body")
|
|
|
|
make_html_top(bodycc)
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
cat_class_parent = bodycc
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
cat_class_parent = div
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h1 = ET.SubElement(cat_class_parent, "h2")
|
|
|
|
h1.text = "Class List By Category"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
class_cat_table = {}
|
|
|
|
class_cat_list = []
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
for c in class_list:
|
|
|
|
clss = classes[c]
|
|
|
|
if ("category" in clss.attrib):
|
2016-11-02 22:28:28 +01:00
|
|
|
class_cat = clss.attrib["category"]
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
class_cat = "Core"
|
|
|
|
if (class_cat.find("/") != -1):
|
|
|
|
class_cat = class_cat[class_cat.rfind("/") + 1:]
|
2016-11-02 22:26:55 +01:00
|
|
|
if (not class_cat in class_cat_list):
|
|
|
|
class_cat_list.append(class_cat)
|
2016-11-02 22:28:28 +01:00
|
|
|
class_cat_table[class_cat] = []
|
2016-11-02 22:26:55 +01:00
|
|
|
class_cat_table[class_cat].append(c)
|
|
|
|
|
|
|
|
class_cat_list.sort()
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
ct = ET.SubElement(cat_class_parent, "table")
|
2016-11-02 22:26:55 +01:00
|
|
|
for cl in class_cat_list:
|
|
|
|
l = class_cat_table[cl]
|
|
|
|
l.sort()
|
2016-11-02 22:28:28 +01:00
|
|
|
tr = ET.SubElement(ct, "tr")
|
|
|
|
tr.attrib["class"] = "category_title"
|
|
|
|
td = ET.SubElement(ct, "td")
|
|
|
|
td.attrib["class"] = "category_title"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
a = ET.SubElement(td, "a")
|
|
|
|
a.attrib["class"] = "category_title"
|
|
|
|
a.text = cl
|
|
|
|
a.attrib["name"] = "CATEGORY_" + cl
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
td = ET.SubElement(ct, "td")
|
|
|
|
td.attrib["class"] = "category_title"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
for clt in l:
|
2016-11-02 22:28:28 +01:00
|
|
|
tr = ET.SubElement(ct, "tr")
|
|
|
|
td = ET.SubElement(ct, "td")
|
|
|
|
make_type(clt, td)
|
|
|
|
clss = classes[clt]
|
2016-11-02 22:26:55 +01:00
|
|
|
bd = clss.find("brief_description")
|
2016-11-02 22:28:28 +01:00
|
|
|
bdtext = ""
|
|
|
|
if (bd != None):
|
|
|
|
bdtext = bd.text
|
|
|
|
td = ET.SubElement(ct, "td")
|
|
|
|
td.text = bdtext
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
if (not single_page):
|
|
|
|
make_html_bottom(bodycc)
|
|
|
|
catet_out = ET.ElementTree(cat_class_list)
|
|
|
|
catet_out.write("category.html")
|
|
|
|
|
|
|
|
if (not single_page):
|
2016-11-02 22:28:28 +01:00
|
|
|
inh_class_list = ET.Element("html")
|
2016-11-02 22:26:55 +01:00
|
|
|
cssic = ET.SubElement(inh_class_list, "link")
|
|
|
|
cssic.attrib["href"] = "main.css"
|
|
|
|
cssic.attrib["rel"] = "stylesheet"
|
|
|
|
cssic.attrib["type"] = "text/css"
|
|
|
|
bodyic = ET.SubElement(inh_class_list, "body")
|
|
|
|
make_html_top(bodyic)
|
2016-11-02 22:28:28 +01:00
|
|
|
inh_class_parent = bodyic
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
inh_class_parent = div
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h1 = ET.SubElement(inh_class_parent, "h2")
|
|
|
|
h1.text = "Class List By Inheritance"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
itemlist = ET.SubElement(inh_class_parent, "list")
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
class_inh_table = {}
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
def add_class(clss):
|
|
|
|
if (clss.attrib["name"] in class_inh_table):
|
2016-11-02 22:28:28 +01:00
|
|
|
return # already added
|
|
|
|
parent_list = None
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
if ("inherits" in clss.attrib):
|
|
|
|
inhc = clss.attrib["inherits"]
|
|
|
|
if (not (inhc in class_inh_table)):
|
|
|
|
add_class(classes[inhc])
|
|
|
|
|
|
|
|
parent_list = class_inh_table[inhc].find("div")
|
|
|
|
if (parent_list == None):
|
2016-11-02 22:28:28 +01:00
|
|
|
parent_div = ET.SubElement(class_inh_table[inhc], "div")
|
|
|
|
parent_list = ET.SubElement(parent_div, "list")
|
|
|
|
parent_div.attrib["class"] = "inh_class_list"
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
|
|
|
parent_list = parent_list.find("list")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
parent_list = itemlist
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
item = ET.SubElement(parent_list, "li")
|
2014-02-10 02:10:30 +01:00
|
|
|
# item.attrib["class"]="inh_class_list"
|
2016-11-02 22:28:28 +01:00
|
|
|
class_inh_table[clss.attrib["name"]] = item
|
|
|
|
make_type(clss.attrib["name"], item)
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for c in class_list:
|
|
|
|
add_class(classes[c])
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
if (not single_page):
|
|
|
|
make_html_bottom(bodyic)
|
|
|
|
catet_out = ET.ElementTree(inh_class_list)
|
|
|
|
catet_out.write("inheritance.html")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
# h1=ET.SubElement(div,"h2")
|
2016-11-02 22:26:55 +01:00
|
|
|
#h1.text="Class List By Inheritance"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
return div
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
def make_type(p_type, p_parent):
|
|
|
|
if (p_type == "RefPtr"):
|
|
|
|
p_type = "Resource"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
if (p_type in class_names):
|
2016-11-02 22:28:28 +01:00
|
|
|
a = ET.SubElement(p_parent, "a")
|
|
|
|
a.attrib["class"] = "datatype_existing"
|
|
|
|
a.text = p_type + " "
|
2016-11-02 22:26:55 +01:00
|
|
|
if (single_page):
|
2016-11-02 22:28:28 +01:00
|
|
|
a.attrib["href"] = "#" + p_type
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
a.attrib["href"] = p_type + ".html"
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(p_parent, "span")
|
|
|
|
span.attrib["class"] = "datatype"
|
|
|
|
span.text = p_type + " "
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
def make_text_def(class_name, parent, text):
|
2016-11-02 22:26:55 +01:00
|
|
|
text = html_escape(text)
|
2016-11-02 22:28:28 +01:00
|
|
|
pos = 0
|
2016-11-02 22:26:55 +01:00
|
|
|
while(True):
|
2016-11-02 22:28:28 +01:00
|
|
|
pos = text.find("[", pos)
|
|
|
|
if (pos == -1):
|
2016-11-02 22:26:55 +01:00
|
|
|
break
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
endq_pos = text.find("]", pos + 1)
|
|
|
|
if (endq_pos == -1):
|
2016-11-02 22:26:55 +01:00
|
|
|
break
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
pre_text = text[:pos]
|
|
|
|
post_text = text[endq_pos + 1:]
|
|
|
|
tag_text = text[pos + 1:endq_pos]
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
if (tag_text in class_names):
|
|
|
|
if (single_page):
|
2016-11-02 22:28:28 +01:00
|
|
|
tag_text = '<a href="#' + tag_text + '">' + tag_text + '</a>'
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
tag_text = '<a href="' + tag_text + '.html">' + tag_text + '</a>'
|
|
|
|
else: # command
|
|
|
|
cmd = tag_text
|
|
|
|
space_pos = tag_text.find(" ")
|
|
|
|
if (cmd.find("html") == 0):
|
|
|
|
cmd = tag_text[:space_pos]
|
|
|
|
param = tag_text[space_pos + 1:]
|
|
|
|
tag_text = "<" + param + ">"
|
|
|
|
elif(cmd.find("method") == 0):
|
|
|
|
cmd = tag_text[:space_pos]
|
|
|
|
param = tag_text[space_pos + 1:]
|
|
|
|
|
|
|
|
if (not single_page and param.find(".") != -1):
|
|
|
|
class_param, method_param = param.split(".")
|
|
|
|
tag_text = tag_text = '<a href="' + class_param + '.html#' + class_param + "_" + method_param + '">' + class_param + '.' + method_param + '()</a>'
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
tag_text = tag_text = '<a href="#' + class_name + "_" + param + '">' + class_name + '.' + param + '()</a>'
|
|
|
|
elif (cmd.find("image=") == 0):
|
|
|
|
print("found image: " + cmd)
|
|
|
|
tag_text = "<img src=" + cmd[6:] + "/>"
|
|
|
|
elif (cmd.find("url=") == 0):
|
|
|
|
tag_text = "<a href=" + cmd[4:] + ">"
|
|
|
|
elif (cmd == "/url"):
|
|
|
|
tag_text = "</a>"
|
|
|
|
elif (cmd == "center"):
|
|
|
|
tag_text = "<div align=\"center\">"
|
|
|
|
elif (cmd == "/center"):
|
|
|
|
tag_text = "</div>"
|
|
|
|
elif (cmd == "br"):
|
|
|
|
tag_text = "<br/>"
|
|
|
|
elif (cmd == "i" or cmd == "/i" or cmd == "b" or cmd == "/b" or cmd == "u" or cmd == "/u"):
|
|
|
|
tag_text = "<" + tag_text + ">" # html direct mapping
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
tag_text = "[" + tag_text + "]"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
text = pre_text + tag_text + post_text
|
|
|
|
pos = len(pre_text) + len(tag_text)
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
#tnode = ET.SubElement(parent,"div")
|
2016-11-02 22:28:28 +01:00
|
|
|
# tnode.text=text
|
|
|
|
text = "<div class=\"description\">" + text + "</div>"
|
2016-11-02 22:26:55 +01:00
|
|
|
try:
|
2016-11-02 22:28:28 +01:00
|
|
|
tnode = ET.XML(text)
|
2016-11-02 22:26:55 +01:00
|
|
|
parent.append(tnode)
|
|
|
|
except:
|
2016-11-02 22:28:28 +01:00
|
|
|
print("Error parsing description text: '" + text + "'")
|
2016-11-02 22:26:55 +01:00
|
|
|
sys.exit(255)
|
|
|
|
|
|
|
|
return tnode
|
|
|
|
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
def make_method_def(name, m, declare, event=False):
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
mdata = {}
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
if (not declare):
|
2016-11-02 22:28:28 +01:00
|
|
|
div = ET.Element("tr")
|
|
|
|
div.attrib["class"] = "method"
|
|
|
|
ret_parent = ET.SubElement(div, "td")
|
|
|
|
ret_parent.attrib["align"] = "right"
|
|
|
|
func_parent = ET.SubElement(div, "td")
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
div = ET.Element("div")
|
|
|
|
div.attrib["class"] = "method"
|
|
|
|
ret_parent = div
|
|
|
|
func_parent = div
|
|
|
|
|
|
|
|
mdata["argidx"] = []
|
|
|
|
mdata["name"] = m.attrib["name"]
|
|
|
|
qualifiers = ""
|
2016-11-02 22:26:55 +01:00
|
|
|
if ("qualifiers" in m.attrib):
|
2016-11-02 22:28:28 +01:00
|
|
|
qualifiers = m.attrib["qualifiers"]
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
args = list(m)
|
2016-11-02 22:26:55 +01:00
|
|
|
for a in args:
|
2016-11-02 22:28:28 +01:00
|
|
|
if (a.tag == "return"):
|
|
|
|
idx = -1
|
|
|
|
elif (a.tag == "argument"):
|
|
|
|
idx = int(a.attrib["index"])
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
|
|
|
continue
|
|
|
|
|
|
|
|
mdata["argidx"].append(idx)
|
2016-11-02 22:28:28 +01:00
|
|
|
mdata[idx] = a
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
if (not event):
|
|
|
|
if (-1 in mdata["argidx"]):
|
2016-11-02 22:28:28 +01:00
|
|
|
make_type(mdata[-1].attrib["type"], ret_parent)
|
2016-11-02 22:26:55 +01:00
|
|
|
mdata["argidx"].remove(-1)
|
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
make_type("void", ret_parent)
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(func_parent, "span")
|
2016-11-02 22:26:55 +01:00
|
|
|
if (declare):
|
2016-11-02 22:28:28 +01:00
|
|
|
span.attrib["class"] = "funcdecl"
|
|
|
|
a = ET.SubElement(span, "a")
|
|
|
|
a.attrib["name"] = name + "_" + m.attrib["name"]
|
|
|
|
a.text = name + "::" + m.attrib["name"]
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
span.attrib["class"] = "identifier funcdef"
|
|
|
|
a = ET.SubElement(span, "a")
|
|
|
|
a.attrib["href"] = "#" + name + "_" + m.attrib["name"]
|
|
|
|
a.text = m.attrib["name"]
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(func_parent, "span")
|
|
|
|
span.attrib["class"] = "symbol"
|
|
|
|
span.text = " ("
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for a in mdata["argidx"]:
|
2016-11-02 22:28:28 +01:00
|
|
|
arg = mdata[a]
|
|
|
|
if (a > 0):
|
|
|
|
span = ET.SubElement(func_parent, "span")
|
|
|
|
span.text = ", "
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(func_parent, "span")
|
|
|
|
span.text = " "
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
make_type(arg.attrib["type"], func_parent)
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(func_parent, "span")
|
|
|
|
span.text = arg.attrib["name"]
|
2016-11-02 22:26:55 +01:00
|
|
|
if ("default" in arg.attrib):
|
2016-11-02 22:28:28 +01:00
|
|
|
span.text = span.text + "=" + arg.attrib["default"]
|
2016-11-02 22:26:55 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(func_parent, "span")
|
|
|
|
span.attrib["class"] = "symbol"
|
2016-11-02 22:26:55 +01:00
|
|
|
if (len(mdata["argidx"])):
|
2016-11-02 22:28:28 +01:00
|
|
|
span.text = " )"
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
span.text = ")"
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
if (qualifiers):
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(func_parent, "span")
|
|
|
|
span.attrib["class"] = "qualifier"
|
|
|
|
span.text = " " + qualifiers
|
2016-11-02 22:26:55 +01:00
|
|
|
|
|
|
|
return div
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
def make_html_class(node):
|
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
div = ET.Element("div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div.attrib["class"] = "class"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
a = ET.SubElement(div, "a")
|
|
|
|
a.attrib["name"] = node.attrib["name"]
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h3 = ET.SubElement(a, "h3")
|
|
|
|
h3.attrib["class"] = "title class_title"
|
|
|
|
h3.text = node.attrib["name"]
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
briefd = node.find("brief_description")
|
2016-11-02 22:28:28 +01:00
|
|
|
if (briefd != None):
|
|
|
|
div2 = ET.SubElement(div, "div")
|
|
|
|
div2.attrib["class"] = "description class_description"
|
|
|
|
div2.text = briefd.text
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
if ("inherits" in node.attrib):
|
2016-11-02 22:28:28 +01:00
|
|
|
ET.SubElement(div, "br")
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
div2 = ET.SubElement(div, "div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div2.attrib["class"] = "inheritance"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(div2, "span")
|
|
|
|
span.text = "Inherits: "
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
make_type(node.attrib["inherits"], div2)
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
if ("category" in node.attrib):
|
2016-11-02 22:28:28 +01:00
|
|
|
ET.SubElement(div, "br")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
div3 = ET.SubElement(div, "div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div3.attrib["class"] = "category"
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(div3, "span")
|
|
|
|
span.attrib["class"] = "category"
|
|
|
|
span.text = "Category: "
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
a = ET.SubElement(div3, "a")
|
|
|
|
a.attrib["class"] = "category_ref"
|
|
|
|
a.text = node.attrib["category"]
|
|
|
|
catname = a.text
|
|
|
|
if (catname.rfind("/") != -1):
|
|
|
|
catname = catname[catname.rfind("/"):]
|
|
|
|
catname = "CATEGORY_" + catname
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
if (single_page):
|
2016-11-02 22:28:28 +01:00
|
|
|
a.attrib["href"] = "#" + catname
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
2016-11-02 22:28:28 +01:00
|
|
|
a.attrib["href"] = "category.html#" + catname
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
methods = node.find("methods")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
if(methods != None and len(list(methods)) > 0):
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h4 = ET.SubElement(div, "h4")
|
|
|
|
h4.text = "Public Methods:"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
method_table = ET.SubElement(div, "table")
|
2016-11-02 22:30:34 +01:00
|
|
|
method_table.attrib["class"] = "method_list"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for m in list(methods):
|
|
|
|
# li = ET.SubElement(div2, "li")
|
2016-11-02 22:28:28 +01:00
|
|
|
method_table.append(make_method_def(node.attrib["name"], m, False))
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
events = node.find("signals")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
if(events != None and len(list(events)) > 0):
|
|
|
|
h4 = ET.SubElement(div, "h4")
|
|
|
|
h4.text = "Events:"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
event_table = ET.SubElement(div, "table")
|
2016-11-02 22:30:34 +01:00
|
|
|
event_table.attrib["class"] = "method_list"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for m in list(events):
|
|
|
|
# li = ET.SubElement(div2, "li")
|
2016-11-02 22:28:28 +01:00
|
|
|
event_table.append(make_method_def(node.attrib["name"], m, False, True))
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
members = node.find("members")
|
2016-11-02 22:28:28 +01:00
|
|
|
if(members != None and len(list(members)) > 0):
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h4 = ET.SubElement(div, "h4")
|
|
|
|
h4.text = "Public Variables:"
|
|
|
|
div2 = ET.SubElement(div, "div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div2.attrib["class"] = "member_list"
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for c in list(members):
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
li = ET.SubElement(div2, "li")
|
2016-11-02 22:28:28 +01:00
|
|
|
div3 = ET.SubElement(li, "div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div3.attrib["class"] = "member"
|
2016-11-02 22:28:28 +01:00
|
|
|
make_type(c.attrib["type"], div3)
|
|
|
|
span = ET.SubElement(div3, "span")
|
|
|
|
span.attrib["class"] = "identifier member_name"
|
|
|
|
span.text = " " + c.attrib["name"] + " "
|
|
|
|
span = ET.SubElement(div3, "span")
|
|
|
|
span.attrib["class"] = "member_description"
|
|
|
|
span.text = c.text
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
constants = node.find("constants")
|
2016-11-02 22:28:28 +01:00
|
|
|
if(constants != None and len(list(constants)) > 0):
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h4 = ET.SubElement(div, "h4")
|
|
|
|
h4.text = "Constants:"
|
|
|
|
div2 = ET.SubElement(div, "div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div2.attrib["class"] = "constant_list"
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for c in list(constants):
|
|
|
|
li = ET.SubElement(div2, "li")
|
2016-11-02 22:28:28 +01:00
|
|
|
div3 = ET.SubElement(li, "div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div3.attrib["class"] = "constant"
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(div3, "span")
|
|
|
|
span.attrib["class"] = "identifier constant_name"
|
|
|
|
span.text = c.attrib["name"] + " "
|
2016-11-02 22:26:55 +01:00
|
|
|
if ("value" in c.attrib):
|
2016-11-02 22:28:28 +01:00
|
|
|
span = ET.SubElement(div3, "span")
|
|
|
|
span.attrib["class"] = "symbol"
|
|
|
|
span.text = "= "
|
|
|
|
span = ET.SubElement(div3, "span")
|
|
|
|
span.attrib["class"] = "constant_value"
|
|
|
|
span.text = c.attrib["value"] + " "
|
|
|
|
span = ET.SubElement(div3, "span")
|
|
|
|
span.attrib["class"] = "constant_description"
|
|
|
|
span.text = c.text
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
# ET.SubElement(div,"br")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
descr = node.find("description")
|
|
|
|
if (descr != None and descr.text.strip() != ""):
|
|
|
|
h4 = ET.SubElement(div, "h4")
|
|
|
|
h4.text = "Description:"
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
make_text_def(node.attrib["name"], div, descr.text)
|
2016-04-02 20:26:12 +02:00
|
|
|
# div2=ET.SubElement(div,"div")
|
2014-02-10 02:10:30 +01:00
|
|
|
# div2.attrib["class"]="description";
|
|
|
|
# div2.text=descr.text
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
if(methods != None or events != None):
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
h4 = ET.SubElement(div, "h4")
|
|
|
|
h4.text = "Method Documentation:"
|
2016-11-02 22:26:55 +01:00
|
|
|
iter_list = []
|
2016-11-02 22:28:28 +01:00
|
|
|
if (methods != None):
|
|
|
|
iter_list += list(methods)
|
|
|
|
if (events != None):
|
|
|
|
iter_list += list(events)
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for m in iter_list:
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
descr = m.find("description")
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
if (descr == None or descr.text.strip() == ""):
|
2016-11-02 22:30:34 +01:00
|
|
|
continue
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
div2 = ET.SubElement(div, "div")
|
2016-11-02 22:30:34 +01:00
|
|
|
div2.attrib["class"] = "method_doc"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
div2.append(make_method_def(node.attrib["name"], m, True))
|
2016-11-02 22:26:55 +01:00
|
|
|
#anchor = ET.SubElement(div2, "a")
|
2016-11-02 22:28:28 +01:00
|
|
|
# anchor.attrib["name"] =
|
|
|
|
make_text_def(node.attrib["name"], div2, descr.text)
|
|
|
|
# div3=ET.SubElement(div2,"div")
|
|
|
|
# div3.attrib["class"]="description";
|
|
|
|
# div3.text=descr.text
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
return div
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
class_names = []
|
|
|
|
classes = {}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
for file in input_list:
|
2016-11-02 22:26:55 +01:00
|
|
|
tree = ET.parse(file)
|
2016-11-02 22:28:28 +01:00
|
|
|
doc = tree.getroot()
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
if ("version" not in doc.attrib):
|
|
|
|
print("Version missing from 'doc'")
|
|
|
|
sys.exit(255)
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
version = doc.attrib["version"]
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-02 22:26:55 +01:00
|
|
|
for c in list(doc):
|
|
|
|
if (c.attrib["name"] in class_names):
|
|
|
|
continue
|
|
|
|
class_names.append(c.attrib["name"])
|
2016-11-02 22:28:28 +01:00
|
|
|
classes[c.attrib["name"]] = c
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
html = ET.Element("html")
|
|
|
|
css = ET.SubElement(html, "link")
|
|
|
|
css.attrib["href"] = "main.css"
|
|
|
|
css.attrib["rel"] = "stylesheet"
|
|
|
|
css.attrib["type"] = "text/css"
|
|
|
|
|
|
|
|
body = ET.SubElement(html, "body")
|
|
|
|
if (not single_page):
|
2016-11-02 22:26:55 +01:00
|
|
|
make_html_top(body)
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
class_names.sort()
|
2016-04-02 20:26:12 +02:00
|
|
|
|
2016-11-02 22:28:28 +01:00
|
|
|
body.append(make_html_class_list(class_names, 5))
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
for cn in class_names:
|
2016-11-02 22:28:28 +01:00
|
|
|
c = classes[cn]
|
2016-11-02 22:26:55 +01:00
|
|
|
if (single_page):
|
2016-11-02 22:28:28 +01:00
|
|
|
body.append(make_html_class(c))
|
2016-11-02 22:26:55 +01:00
|
|
|
else:
|
|
|
|
html2 = ET.Element("html")
|
|
|
|
css = ET.SubElement(html2, "link")
|
|
|
|
css.attrib["href"] = "main.css"
|
|
|
|
css.attrib["rel"] = "stylesheet"
|
|
|
|
css.attrib["type"] = "text/css"
|
2016-11-02 22:28:28 +01:00
|
|
|
body2 = ET.SubElement(html2, "body")
|
2016-11-02 22:26:55 +01:00
|
|
|
make_html_top(body2)
|
2016-11-02 22:30:34 +01:00
|
|
|
body2.append(make_html_class(c))
|
2016-11-02 22:26:55 +01:00
|
|
|
make_html_bottom(body2)
|
|
|
|
et_out = ET.ElementTree(html2)
|
2016-11-02 22:28:28 +01:00
|
|
|
et_out.write(c.attrib["name"] + ".html")
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
et_out = ET.ElementTree(html)
|
|
|
|
if (single_page):
|
2016-11-02 22:26:55 +01:00
|
|
|
et_out.write("singlepage.html")
|
2014-02-10 02:10:30 +01:00
|
|
|
else:
|
2016-11-02 22:26:55 +01:00
|
|
|
make_html_bottom(body)
|
|
|
|
et_out.write("alphabetical.html")
|