2013-12-22 18:55:48 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
import monkDebug as debug
|
|
|
|
import sys
|
|
|
|
import monkTools
|
|
|
|
#import CppHeaderParser
|
|
|
|
import re
|
|
|
|
import codeBB
|
|
|
|
import collections
|
2013-12-26 21:17:20 +01:00
|
|
|
import monkModule as module
|
|
|
|
import monkNode as node
|
2013-12-22 18:55:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
def display_doxygen_param(comment, input, output):
|
2013-12-27 21:35:30 +01:00
|
|
|
data = '<tr>'
|
|
|
|
data = '<td>'
|
|
|
|
data += "<b>Parameter"
|
2013-12-22 18:55:48 +01:00
|
|
|
if input == True:
|
|
|
|
data += " [input]"
|
|
|
|
if output == True:
|
|
|
|
data += " [output]"
|
2013-12-27 21:35:30 +01:00
|
|
|
data += ":</b>"
|
|
|
|
data += '</td>'
|
2013-12-22 18:55:48 +01:00
|
|
|
#extract first element:
|
|
|
|
val = comment.find(" ")
|
|
|
|
var = comment[:val]
|
|
|
|
endComment = comment[val:]
|
2013-12-27 21:35:30 +01:00
|
|
|
data += '<td>'
|
2013-12-22 18:55:48 +01:00
|
|
|
# TODO : Check if it exist in the parameter list ...
|
2013-12-27 21:35:30 +01:00
|
|
|
data += "<span class=\"code-argument\">" + var + "</span> "
|
|
|
|
data += '</td>'
|
|
|
|
data += '<td>'
|
|
|
|
data += codeBB.transcode(endComment)
|
|
|
|
data += '</td>'
|
|
|
|
data += '</tr>\n'
|
2013-12-22 18:55:48 +01:00
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
|
|
def parse_doxygen(data) :
|
2013-12-28 12:44:01 +01:00
|
|
|
data = "\n" + data
|
2013-12-27 07:57:16 +01:00
|
|
|
if '@' in data:
|
2013-12-28 12:44:01 +01:00
|
|
|
streams = data.split("\n@")
|
2013-12-27 07:57:16 +01:00
|
|
|
else:
|
|
|
|
streams = [ "brief " + data]
|
2013-12-22 18:55:48 +01:00
|
|
|
data2 = ''
|
|
|
|
for element in streams:
|
|
|
|
if element[:1] == "\n" \
|
|
|
|
or element[:2] == "\n\n":
|
|
|
|
# nothing to do : Nomale case of the first \n
|
|
|
|
None
|
|
|
|
elif element[:6] == "brief ":
|
2013-12-27 21:35:30 +01:00
|
|
|
data2 += codeBB.transcode(element[6:])
|
|
|
|
data2 += '<br/>'
|
2013-12-22 18:55:48 +01:00
|
|
|
|
|
|
|
for element in streams:
|
|
|
|
if element[:1] == "\n" \
|
|
|
|
or element[:2] == "\n\n":
|
|
|
|
# nothing to do : Nomale case of the first \n
|
|
|
|
None
|
|
|
|
elif element[:5] == "note ":
|
2013-12-27 21:35:30 +01:00
|
|
|
data2 += '<b>Note:</b> '
|
|
|
|
data2 += codeBB.transcode(element[5:])
|
|
|
|
data2 += '<br/> '
|
2013-12-22 18:55:48 +01:00
|
|
|
|
|
|
|
data3 = ''
|
2013-12-27 21:35:30 +01:00
|
|
|
dataReturn = ''
|
2013-12-22 18:55:48 +01:00
|
|
|
for element in streams:
|
|
|
|
if element[:1] == "\n" \
|
|
|
|
or element[:2] == "\n\n":
|
|
|
|
# nothing to do : Nomale case of the first \n
|
2013-12-28 12:44:01 +01:00
|
|
|
pass
|
2013-12-22 18:55:48 +01:00
|
|
|
elif element[:14] == "param[in,out] " \
|
|
|
|
or element[:14] == "param[out,in] ":
|
|
|
|
data3 += display_doxygen_param(element[14:], True, True)
|
|
|
|
elif element[:10] == "param[in] ":
|
|
|
|
data3 += display_doxygen_param(element[10:], True, False)
|
|
|
|
elif element[:11] == "param[out] ":
|
|
|
|
data3 += display_doxygen_param(element[11:], False, True)
|
|
|
|
elif element[:6] == "param ":
|
|
|
|
data3 += display_doxygen_param(element[6:], False, False)
|
|
|
|
elif element[:7] == "return ":
|
2013-12-27 21:35:30 +01:00
|
|
|
if dataReturn != "":
|
|
|
|
dataReturn += '<br/>'
|
|
|
|
dataReturn += element[7:]
|
|
|
|
if data3 != '' \
|
|
|
|
or dataReturn != '':
|
|
|
|
data2 += '<ul>\n'
|
|
|
|
data2 += '<table class="parameter-list">\n'
|
2013-12-22 18:55:48 +01:00
|
|
|
data2 += data3
|
2013-12-27 21:35:30 +01:00
|
|
|
if dataReturn != "":
|
|
|
|
data2 += '<tr><td>'
|
|
|
|
data2 += '<b>Return: </b>'
|
|
|
|
data2 += '</td><td></td><td>'
|
|
|
|
data2 += codeBB.transcode(dataReturn)
|
|
|
|
data2 += '</td></tr>'
|
|
|
|
data2 += '</table>\n'
|
|
|
|
data2 += '</ul>\n'
|
2013-12-22 18:55:48 +01:00
|
|
|
return data2
|
|
|
|
|
|
|
|
def white_space(size) :
|
|
|
|
ret = ''
|
|
|
|
for iii in range(len(ret), size):
|
|
|
|
ret += " "
|
|
|
|
return ret
|
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
def generate_menu(element, level=1):
|
|
|
|
namespaceStack = element.get_namespace()
|
2013-12-22 18:55:48 +01:00
|
|
|
listBase = element.get_all_sub_type(['namespace'])
|
|
|
|
if len(listBase) == 0:
|
|
|
|
return ""
|
|
|
|
ret = ""
|
|
|
|
ret += '<ul class="niveau' + str(level) + '">\n'
|
|
|
|
for element in listBase:
|
2013-12-25 23:56:09 +01:00
|
|
|
retTmp = generate_menu(element['node'], level+1)
|
2013-12-22 18:55:48 +01:00
|
|
|
if retTmp != "":
|
|
|
|
subMenu = ' class="sousmenu"'
|
|
|
|
else:
|
|
|
|
subMenu = ''
|
2013-12-25 23:56:09 +01:00
|
|
|
ret += ' <li' + subMenu + '>' + generate_link(element['node']) + '\n'
|
2013-12-22 18:55:48 +01:00
|
|
|
ret += retTmp
|
|
|
|
ret += ' </li>\n'
|
|
|
|
ret += '</ul>\n'
|
|
|
|
return ret
|
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
def generate_html_page_name(element):
|
2013-12-26 07:49:52 +01:00
|
|
|
return element.get_doc_website_page_local()
|
2013-12-22 18:55:48 +01:00
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
def generate_name(element):
|
|
|
|
namespaceStack = element.get_namespace()
|
2013-12-22 18:55:48 +01:00
|
|
|
link = ""
|
|
|
|
for name in namespaceStack:
|
|
|
|
link += name + "::"
|
|
|
|
return element.get_node_type() + ": " + link + element.get_name()
|
|
|
|
|
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
def generate_link(element):
|
|
|
|
return '<a href="' + generate_html_page_name(element) + '">' + element.get_name() + '</a>'
|
2013-12-22 18:55:48 +01:00
|
|
|
|
|
|
|
def calculate_methode_size(list):
|
|
|
|
returnSize = 0;
|
|
|
|
methodeSize = 0;
|
2013-12-26 21:17:20 +01:00
|
|
|
haveVirtual = False
|
2013-12-22 18:55:48 +01:00
|
|
|
for element in list:
|
2013-12-28 12:44:01 +01:00
|
|
|
if element['node'].get_node_type() == 'methode' \
|
|
|
|
and element['node'].get_virtual() == True:
|
2013-12-26 21:17:20 +01:00
|
|
|
haveVirtual = True
|
2013-12-28 12:44:01 +01:00
|
|
|
if element['node'].get_node_type() == 'variable':
|
|
|
|
retType = element['node'].get_type().to_str()
|
|
|
|
else:
|
|
|
|
retType = element['node'].get_return_type().to_str()
|
2013-12-22 18:55:48 +01:00
|
|
|
tmpLen = len(retType)
|
|
|
|
if returnSize < tmpLen:
|
|
|
|
returnSize = tmpLen
|
|
|
|
tmpLen = len(element['node'].get_name())
|
|
|
|
if methodeSize < tmpLen:
|
|
|
|
methodeSize = tmpLen
|
2013-12-26 21:17:20 +01:00
|
|
|
return [returnSize, methodeSize, haveVirtual]
|
2013-12-22 18:55:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
def write_methode(element, namespaceStack, displaySize = None, link = True):
|
2013-12-27 21:35:30 +01:00
|
|
|
if element['node'].get_request_hidden() == True:
|
2013-12-28 12:44:01 +01:00
|
|
|
return ""
|
2013-12-22 18:55:48 +01:00
|
|
|
if displaySize == None:
|
|
|
|
displaySize = calculate_methode_size([element])
|
|
|
|
ret = ""
|
|
|
|
if 'access' in element.keys():
|
|
|
|
if element['access'] == 'private':
|
|
|
|
ret += '- '
|
2013-12-28 12:44:01 +01:00
|
|
|
return ""
|
2013-12-22 18:55:48 +01:00
|
|
|
elif element['access'] == 'protected':
|
|
|
|
ret += '# '
|
|
|
|
elif element['access'] == 'public':
|
|
|
|
ret += '+ '
|
|
|
|
else:
|
|
|
|
ret += ' '
|
2013-12-26 21:17:20 +01:00
|
|
|
else:
|
|
|
|
ret += ' '
|
|
|
|
|
2013-12-28 12:44:01 +01:00
|
|
|
if element['node'].get_node_type() == 'variable':
|
|
|
|
if displaySize[2] == True:
|
|
|
|
ret += ' '
|
|
|
|
raw, decorated = element['node'].get_type().to_str_decorated()
|
|
|
|
else:
|
|
|
|
if element['node'].get_virtual() == True:
|
|
|
|
ret += module.display_color('virtual') + ' '
|
|
|
|
elif displaySize[2] == True:
|
|
|
|
ret += ' '
|
|
|
|
|
|
|
|
raw, decorated = element['node'].get_return_type().to_str_decorated()
|
2013-12-26 21:17:20 +01:00
|
|
|
if raw != "":
|
|
|
|
ret += decorated
|
2013-12-22 18:55:48 +01:00
|
|
|
ret += " "
|
2013-12-26 21:17:20 +01:00
|
|
|
raw += " "
|
2013-12-28 12:44:01 +01:00
|
|
|
|
2013-12-26 21:17:20 +01:00
|
|
|
ret += white_space(displaySize[0] - len(raw)+1)
|
2013-12-22 18:55:48 +01:00
|
|
|
name = element['node'].get_name()
|
2013-12-28 12:44:01 +01:00
|
|
|
|
|
|
|
if element['node'].get_node_type() == 'variable':
|
|
|
|
classDecoration = "code-member"
|
|
|
|
else:
|
|
|
|
classDecoration = "code-function"
|
|
|
|
|
2013-12-22 18:55:48 +01:00
|
|
|
if link == True:
|
2013-12-28 12:44:01 +01:00
|
|
|
ret += '<a class="' + classDecoration + '" href="#' + str(element['node'].get_uid()) + '">' + name + '</a>'
|
2013-12-22 18:55:48 +01:00
|
|
|
else:
|
2013-12-28 12:44:01 +01:00
|
|
|
ret += '<span class="' + classDecoration + '">' + name + '</span>'
|
2013-12-22 18:55:48 +01:00
|
|
|
|
2013-12-28 12:44:01 +01:00
|
|
|
if element['node'].get_node_type() != 'variable':
|
|
|
|
ret += white_space(displaySize[1] - len(name)) + ' ('
|
|
|
|
listParam = element['node'].get_param()
|
|
|
|
first = True
|
|
|
|
for param in listParam:
|
|
|
|
if first == False:
|
|
|
|
ret += ',<br/>'
|
|
|
|
if displaySize[2] == True:
|
|
|
|
ret += ' '
|
|
|
|
ret += white_space(displaySize[0] + displaySize[1] +5)
|
|
|
|
first = False
|
|
|
|
typeNoDecoration, typeDecorated = param.get_type().to_str_decorated()
|
|
|
|
#retParam = module.display_color(param.get_type().to_str())
|
|
|
|
retParam = typeDecorated
|
|
|
|
if retParam != "":
|
|
|
|
ret += retParam
|
|
|
|
ret += " "
|
|
|
|
ret += "<span class=\"code-argument\">" + param.get_name() + "</span>"
|
|
|
|
ret += ')'
|
|
|
|
if element['node'].get_virtual_pure() == True:
|
|
|
|
ret += ' = 0'
|
|
|
|
if element['node'].get_constant() == True:
|
|
|
|
ret += module.display_color(' const')
|
|
|
|
|
2013-12-22 18:55:48 +01:00
|
|
|
ret += ';'
|
|
|
|
ret += '<br/>'
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def generate_stupid_index_page(outFolder, header, footer, myLutinDoc):
|
|
|
|
# create index.hml :
|
|
|
|
filename = outFolder + "/index.html"
|
|
|
|
monkTools.create_directory_of_file(filename);
|
|
|
|
file = open(filename, "w")
|
|
|
|
file.write(header)
|
|
|
|
file.write("<h1>" + myLutinDoc.get_base_doc_node().get_name() + "</h1>");
|
|
|
|
file.write("<br/>");
|
|
|
|
file.write("TODO : Main page ...");
|
|
|
|
file.write("<br/>");
|
|
|
|
file.write("<br/>");
|
|
|
|
file.write(footer)
|
|
|
|
file.close();
|
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
def generate_page(outFolder, header, footer, element):
|
2013-12-26 21:17:20 +01:00
|
|
|
currentPageSite = element.get_doc_website_page()
|
2013-12-25 23:56:09 +01:00
|
|
|
namespaceStack = element.get_namespace()
|
2013-12-22 18:55:48 +01:00
|
|
|
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union']:
|
|
|
|
listBase = element.get_all_sub_type(['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union'])
|
|
|
|
for elem in listBase:
|
2013-12-25 23:56:09 +01:00
|
|
|
generate_page(outFolder, header, footer, elem['node'])
|
|
|
|
filename = outFolder + '/' + generate_html_page_name(element)
|
2013-12-22 18:55:48 +01:00
|
|
|
monkTools.create_directory_of_file(filename);
|
|
|
|
file = open(filename, "w")
|
|
|
|
file.write(header)
|
2013-12-25 23:56:09 +01:00
|
|
|
file.write('<h1>' + generate_name(element) + '</h1>');
|
|
|
|
file.write('<hr/>');
|
|
|
|
|
|
|
|
documentation = parse_doxygen(element.get_doc())
|
|
|
|
if len(documentation) != 0:
|
|
|
|
file.write('<h2>Description:</h2>\n')
|
|
|
|
file.write(documentation)
|
|
|
|
file.write('<br/>\n')
|
|
|
|
|
2013-12-28 12:44:01 +01:00
|
|
|
if element.get_node_type() in ['namespace']:
|
|
|
|
tmpName = element.get_name()
|
|
|
|
tmpNameUpper = tmpName.upper()
|
|
|
|
tmpName = tmpNameUpper[0] + tmpName[1:]
|
|
|
|
compleateName = ""
|
|
|
|
for namespace in element.get_namespace():
|
|
|
|
compleateName += namespace + "::"
|
|
|
|
compleateName += tmpName
|
|
|
|
associatedClass = module.get_element_with_name(compleateName)
|
|
|
|
if associatedClass != None:
|
|
|
|
file.write('<h2>Associated Class:</h2>');
|
|
|
|
file.write('<ul>\n');
|
|
|
|
file.write(generate_link(associatedClass));
|
|
|
|
file.write('</ul>\n');
|
|
|
|
|
|
|
|
if element.get_node_type() in ['class']:
|
|
|
|
tmpName = element.get_name()
|
|
|
|
tmpNameLower = tmpName.lower()
|
|
|
|
tmpName = tmpNameLower[0] + tmpName[1:]
|
|
|
|
compleateName = ""
|
|
|
|
for namespace in element.get_namespace():
|
|
|
|
compleateName += namespace + "::"
|
|
|
|
compleateName += tmpName
|
|
|
|
associatedClass = module.get_element_with_name(compleateName)
|
|
|
|
if associatedClass != None:
|
|
|
|
file.write('<h2>Associated Namespace:</h2>');
|
|
|
|
file.write('<ul>\n');
|
|
|
|
file.write(generate_link(associatedClass));
|
|
|
|
file.write('</ul>\n');
|
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
|
|
|
|
for nameElement in ['namespace', 'class', 'struct', 'enum', 'union']:
|
|
|
|
listBase = element.get_all_sub_type(nameElement)
|
|
|
|
if len(listBase) == 0:
|
|
|
|
continue
|
2013-12-28 12:44:01 +01:00
|
|
|
descLocal = ""
|
2013-12-25 23:56:09 +01:00
|
|
|
for elem in listBase:
|
2013-12-28 12:44:01 +01:00
|
|
|
if elem['node'].get_request_hidden() == True:
|
|
|
|
continue
|
|
|
|
if 'access' in elem.keys() \
|
|
|
|
and elem['access'] == 'private':
|
|
|
|
continue
|
|
|
|
descLocal += '<li>' + generate_link(elem['node']) + '</li>'
|
|
|
|
if descLocal != "":
|
|
|
|
file.write('<h2>' + nameElement + ':</h2>\n');
|
|
|
|
file.write('<ul>\n');
|
|
|
|
file.write(descLocal)
|
|
|
|
file.write('</ul>\n');
|
2013-12-22 18:55:48 +01:00
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
# calculate element size :
|
2013-12-28 12:44:01 +01:00
|
|
|
listBase = element.get_all_sub_type(['methode', 'constructor', 'destructor', 'variable'])
|
2013-12-25 23:56:09 +01:00
|
|
|
displayLen = calculate_methode_size(listBase)
|
|
|
|
|
|
|
|
if element.get_node_type() == 'class' \
|
|
|
|
or element.get_node_type() == 'struct':
|
2013-12-22 18:55:48 +01:00
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
if len(element.get_all_sub_type(['constructor', 'destructor'])) != 0:
|
2013-12-28 12:44:01 +01:00
|
|
|
globalWrite = ""
|
2013-12-25 23:56:09 +01:00
|
|
|
listBaseConstructor = element.get_all_sub_type(['constructor'])
|
|
|
|
for elem in listBaseConstructor:
|
2013-12-28 12:44:01 +01:00
|
|
|
if elem['access'] == 'private':
|
|
|
|
continue
|
|
|
|
globalWrite += write_methode(elem, namespaceStack, displayLen)
|
2013-12-25 23:56:09 +01:00
|
|
|
listBaseDestructor = element.get_all_sub_type(['destructor'])
|
|
|
|
for elem in listBaseDestructor:
|
2013-12-28 12:44:01 +01:00
|
|
|
if elem['access'] == 'private':
|
|
|
|
continue
|
|
|
|
globalWrite += write_methode(elem, namespaceStack, displayLen)
|
|
|
|
if globalWrite != "":
|
|
|
|
file.write('<h2>Constructor and Destructor:</h2>\n')
|
|
|
|
file.write('<pre>\n');
|
|
|
|
file.write(globalWrite);
|
|
|
|
file.write('</pre>\n');
|
|
|
|
file.write('<br/>\n')
|
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
|
2013-12-28 12:44:01 +01:00
|
|
|
listBaseMethode = element.get_all_sub_type(['methode', 'variable'])
|
2013-12-25 23:56:09 +01:00
|
|
|
if len(listBaseMethode) != 0:
|
2013-12-28 12:44:01 +01:00
|
|
|
globalWrite = ""
|
2013-12-25 23:56:09 +01:00
|
|
|
displayLen = calculate_methode_size(listBaseMethode)
|
|
|
|
for elem in listBaseMethode:
|
2013-12-28 12:44:01 +01:00
|
|
|
if 'access' in elem.keys() \
|
|
|
|
and elem['access'] == 'private':
|
|
|
|
continue
|
|
|
|
globalWrite += write_methode(elem, namespaceStack, displayLen)
|
|
|
|
if globalWrite != "":
|
|
|
|
file.write('<h2>Synopsis:</h2>\n')
|
|
|
|
file.write('<pre>\n');
|
|
|
|
file.write(globalWrite);
|
|
|
|
file.write('</pre>\n')
|
|
|
|
file.write('<br/>\n')
|
2013-12-25 23:56:09 +01:00
|
|
|
|
|
|
|
# generate herirage list :
|
|
|
|
if element.get_node_type() == 'class':
|
|
|
|
parent = element.get_parents()
|
2013-12-26 07:49:52 +01:00
|
|
|
debug.verbose("parrent of " + element.get_name() + " : " + str(parent))
|
2013-12-26 21:17:20 +01:00
|
|
|
child = module.get_whith_specific_parrent(element.get_displayable_name(), )
|
|
|
|
if len(parent) != 0 \
|
|
|
|
or len(child) != 0:
|
2013-12-25 23:56:09 +01:00
|
|
|
file.write('<h2>Object Hierarchy:<h2>\n')
|
|
|
|
file.write('<pre>\n');
|
2013-12-26 07:49:52 +01:00
|
|
|
level = 0
|
2013-12-26 21:17:20 +01:00
|
|
|
parent.append({'access':'me', 'class':element.get_displayable_name()})
|
|
|
|
for parentElem in parent:
|
2013-12-26 07:49:52 +01:00
|
|
|
access = ""
|
|
|
|
if parentElem['access'] == 'public':
|
|
|
|
access = "+"
|
|
|
|
elif parentElem['access'] == 'protected':
|
|
|
|
access = "#"
|
|
|
|
elif parentElem['access'] == 'private':
|
|
|
|
access = "-"
|
2013-12-26 21:17:20 +01:00
|
|
|
tmpLen = level * 7
|
|
|
|
if tmpLen > 0:
|
|
|
|
tmpLen -= 5
|
|
|
|
file.write(white_space(tmpLen))
|
2013-12-26 07:49:52 +01:00
|
|
|
if level != 0:
|
|
|
|
file.write('+--> ')
|
2013-12-26 21:17:20 +01:00
|
|
|
file.write(access)
|
|
|
|
if parentElem['access'] == 'me':
|
|
|
|
file.write(parentElem['class'])
|
|
|
|
else:
|
|
|
|
classPointer = module.get_element_with_name(parentElem['class'])
|
|
|
|
if classPointer != None:
|
|
|
|
link = classPointer.get_doc_website_page()
|
|
|
|
link = node.get_doc_website_page_relative(currentPageSite, link)
|
|
|
|
file.write('<a href="' + link + '">')
|
|
|
|
file.write(parentElem['class'])
|
|
|
|
if classPointer != None:
|
|
|
|
file.write('</a>')
|
|
|
|
|
|
|
|
file.write('<br/>')
|
2013-12-26 07:49:52 +01:00
|
|
|
level += 1
|
2013-12-26 21:17:20 +01:00
|
|
|
# all child not in application :
|
|
|
|
for childElem in child:
|
|
|
|
tmpLen = level * 7
|
|
|
|
if tmpLen > 0:
|
|
|
|
tmpLen -= 5
|
|
|
|
file.write(white_space(tmpLen))
|
|
|
|
if level != 0:
|
|
|
|
file.write('+--> ')
|
|
|
|
classPointer = module.get_element_with_name(childElem)
|
|
|
|
if classPointer != None:
|
|
|
|
link = classPointer.get_doc_website_page()
|
|
|
|
link = node.get_doc_website_page_relative(currentPageSite, link)
|
|
|
|
file.write('<a href="' + link + '">')
|
|
|
|
file.write(childElem)
|
|
|
|
if classPointer != None:
|
|
|
|
file.write('</a>')
|
|
|
|
|
|
|
|
file.write('<br/>')
|
|
|
|
|
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
file.write('</pre>\n');
|
2013-12-22 18:55:48 +01:00
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
|
|
|
|
if len(listBase) != 0:
|
2013-12-22 18:55:48 +01:00
|
|
|
# display all functions :
|
2013-12-27 07:57:16 +01:00
|
|
|
file.write('<h2>Detail:</h2>\n')
|
2013-12-27 21:35:30 +01:00
|
|
|
allDetailDoc = ""
|
|
|
|
lastDoc = ""
|
2013-12-25 23:56:09 +01:00
|
|
|
for subElement in listBase:
|
2013-12-28 12:44:01 +01:00
|
|
|
if subElement['node'].get_request_hidden() == True:
|
|
|
|
continue
|
|
|
|
if 'access' in subElement.keys() \
|
|
|
|
and subElement['access'] == 'private':
|
|
|
|
continue
|
2013-12-27 21:35:30 +01:00
|
|
|
file.write('<a id="' + str(subElement['node'].get_uid()) + '"/>')
|
|
|
|
if lastDoc != "" \
|
|
|
|
and subElement['node'].get_request_in_previous() == True:
|
|
|
|
allDetailDoc += write_methode(subElement, namespaceStack, link = False)
|
|
|
|
else:
|
|
|
|
if lastDoc != "":
|
|
|
|
allDetailDoc += '</pre>\n'
|
|
|
|
allDetailDoc += lastDoc
|
|
|
|
allDetailDoc += '<br/>\n'
|
|
|
|
allDetailDoc += '<hr/>\n'
|
|
|
|
file.write(allDetailDoc);
|
|
|
|
allDetailDoc = ""
|
|
|
|
lastDoc = ""
|
|
|
|
allDetailDoc += '<h3>' + subElement['node'].get_name() + '</h3>'
|
|
|
|
allDetailDoc += '<pre>\n'
|
|
|
|
allDetailDoc += write_methode(subElement, namespaceStack, link = False)
|
|
|
|
lastDoc = parse_doxygen(subElement['node'].get_doc()) + '\n'
|
|
|
|
if lastDoc != "":
|
|
|
|
allDetailDoc += '</pre>\n'
|
|
|
|
allDetailDoc += lastDoc
|
|
|
|
allDetailDoc += '<br/>\n'
|
|
|
|
allDetailDoc += '<hr/>\n'
|
|
|
|
file.write(allDetailDoc);
|
|
|
|
allDetailDoc = ""
|
|
|
|
lastDoc = ""
|
2013-12-22 18:55:48 +01:00
|
|
|
|
2013-12-25 23:56:09 +01:00
|
|
|
if element.get_node_type() == 'enum':
|
|
|
|
myElementList = element.get_enum_list()
|
|
|
|
elementSize = 0
|
|
|
|
for enumElement in myElementList:
|
|
|
|
tmpLen = len(enumElement['name'])
|
|
|
|
if tmpLen > elementSize:
|
|
|
|
elementSize = tmpLen
|
|
|
|
|
|
|
|
|
|
|
|
file.write('<h2>Value list</h2>\n')
|
|
|
|
if len(myElementList) < 9:
|
|
|
|
nbColumn = 1
|
|
|
|
else:
|
|
|
|
nbColumn = 3
|
|
|
|
|
|
|
|
file.write('<ul>\n');
|
|
|
|
file.write('<table class="enumeration-list"><tr>\n');
|
|
|
|
nbCol = 0
|
|
|
|
isFirst = True
|
|
|
|
for enumElement in myElementList:
|
|
|
|
if isFirst == True:
|
|
|
|
file.write('<tr>\n');
|
|
|
|
isFirst = False
|
|
|
|
file.write('<td><a href="#' + enumElement['name'] + '">' + enumElement['name'] + '</a></td>')
|
|
|
|
nbCol += 1
|
|
|
|
if nbCol == nbColumn:
|
|
|
|
nbCol = 0
|
|
|
|
file.write('</tr>\n');
|
|
|
|
isFirst = True
|
|
|
|
if isFirst == False:
|
|
|
|
file.write('</tr>\n');
|
|
|
|
file.write('</table>\n');
|
|
|
|
file.write('</ul>\n');
|
|
|
|
|
2013-12-27 07:57:16 +01:00
|
|
|
file.write("<h2>Detail:</h2>\n")
|
2013-12-25 23:56:09 +01:00
|
|
|
isFirst = True
|
|
|
|
for enumElement in myElementList:
|
|
|
|
if isFirst == False:
|
|
|
|
file.write('<hr/>\n');
|
|
|
|
isFirst = False
|
2013-12-27 07:57:16 +01:00
|
|
|
file.write('<h3><a id="' + enumElement['name'] + '"/>' + enumElement['name'] + '</h3>')
|
2013-12-25 23:56:09 +01:00
|
|
|
file.write('<pre>\n')
|
|
|
|
file.write(enumElement['name'] + white_space(elementSize-len(enumElement['name'])) + ' = <span class="code-type">' + enumElement['value'] + '<span>')
|
|
|
|
file.write('</pre>\n')
|
|
|
|
if enumElement['doc'] != "":
|
|
|
|
file.write(parse_doxygen(enumElement['doc']));
|
|
|
|
|
|
|
|
if element.get_node_type() == 'union':
|
2013-12-22 18:55:48 +01:00
|
|
|
file.write("TODO : the page ...");
|
2013-12-25 23:56:09 +01:00
|
|
|
|
2013-12-22 18:55:48 +01:00
|
|
|
file.write(footer)
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate(myLutinDoc, outFolder) :
|
|
|
|
myDoc = myLutinDoc.get_base_doc_node()
|
|
|
|
monkTools.copy_file(monkTools.get_current_path(__file__)+"/theme/base.css", outFolder+"/base.css")
|
|
|
|
monkTools.copy_file(monkTools.get_current_path(__file__)+"/theme/menu.css", outFolder+"/menu.css")
|
|
|
|
# create common header
|
|
|
|
genericHeader = '<!DOCTYPE html>\n'
|
|
|
|
genericHeader += '<html>\n'
|
|
|
|
genericHeader += '<head>\n'
|
|
|
|
genericHeader += ' <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">\n'
|
|
|
|
genericHeader += ' <title>' + myDoc.get_name() + ' Library</title>\n'
|
|
|
|
genericHeader += ' <link rel="stylesheet" href="base.css">\n'
|
|
|
|
genericHeader += ' <link rel="stylesheet" href="menu.css">\n'
|
|
|
|
genericHeader += '</head>\n'
|
|
|
|
genericHeader += '<body>\n'
|
|
|
|
genericHeader += ' <div class="navbar navbar-fixed-top">\n'
|
|
|
|
genericHeader += ' <div class="container">\n'
|
2013-12-27 21:35:30 +01:00
|
|
|
if myDoc.get_node_type() == 'library':
|
|
|
|
genericHeader += ' <h1><a href="index.html">' + myDoc.get_name() + ' library</a></h1>\n'
|
|
|
|
else:
|
|
|
|
genericHeader += ' <h1><a href="index.html">' + myDoc.get_name() + '</a></h1>\n'
|
2013-12-28 16:07:12 +01:00
|
|
|
if myLutinDoc.get_website_sources() != '':
|
|
|
|
genericHeader += ' <h4><a href="' + myLutinDoc.get_website_sources() + '"> [ sources ]</a></h4>\n'
|
2013-12-27 21:35:30 +01:00
|
|
|
genericHeader += '<h3>API:</h3>'
|
2013-12-22 18:55:48 +01:00
|
|
|
genericHeader += ' <div id="menu">\n'
|
|
|
|
#genericHeader += ' <h2>' + myDoc.moduleName + '</h2>\n'
|
|
|
|
genericHeader += generate_menu(myDoc)
|
|
|
|
#genericHeader += ' <h3> </h3>\n'
|
|
|
|
genericHeader += ' </div>\n'
|
2013-12-27 21:35:30 +01:00
|
|
|
# TODO : add Generic doc main point.
|
|
|
|
if len(myLutinDoc.listDocFile) > 0:
|
|
|
|
genericHeader += '<h3>Documentation:</h3>'
|
|
|
|
genericHeader += '<div id="menu">\n'
|
|
|
|
for docInputName,outpath in myLutinDoc.listDocFile:
|
|
|
|
outputFileName = outFolder + "/" + outpath.replace('/','_') +".html"
|
|
|
|
outputFileName = outputFileName.split('/')[-1]
|
|
|
|
name = outputFileName.split('_')[-1][:-5]
|
|
|
|
if name == "index":
|
|
|
|
continue
|
|
|
|
genericHeader += '<ul class="niveau1">'
|
|
|
|
genericHeader += '<li><a href="' + outputFileName + '">' + name + '</a></li>\n'
|
|
|
|
genericHeader += '</ul>'
|
|
|
|
genericHeader += '</div>\n'
|
|
|
|
# TODO : add Tutorial doc main point.
|
|
|
|
if len(myLutinDoc.listTutorialFile) > 0:
|
|
|
|
genericHeader += '<h3>Tutorials:</h3>'
|
|
|
|
genericHeader += '<div id="menu">\n'
|
|
|
|
for docInputName,outpath in myLutinDoc.listTutorialFile:
|
|
|
|
outputFileName = outFolder + "/" + outpath+".html"
|
|
|
|
outputFileName = outputFileName.split('/')[-1]
|
|
|
|
name = outputFileName.split('_')[-1][:-5]
|
|
|
|
if name == "index":
|
|
|
|
continue
|
|
|
|
genericHeader += '<ul class="niveau1">'
|
|
|
|
genericHeader += '<li><a href="tutorial_' + outputFileName + '">' + name + '</a></li>\n'
|
|
|
|
genericHeader += '</ul>'
|
|
|
|
genericHeader += '</div>\n'
|
|
|
|
|
|
|
|
|
|
|
|
localWebsite = myLutinDoc.get_website()
|
|
|
|
# add other libs entry point :
|
|
|
|
allModule = module.get_all_module()
|
|
|
|
if len(allModule) != 1:
|
|
|
|
genericHeader += '<br/>'
|
|
|
|
genericHeader += '<h3>Associate libraries:</h3>'
|
|
|
|
genericHeader += '<div id="menu">\n'
|
|
|
|
for modd in allModule:
|
|
|
|
if modd.type == 'application':
|
|
|
|
continue
|
|
|
|
if modd.name == myLutinDoc.name:
|
|
|
|
continue
|
|
|
|
genericHeader += '<ul class="niveau1">'
|
|
|
|
link = node.get_doc_website_page_relative(localWebsite, modd.get_website())
|
|
|
|
if link[-1] != "/":
|
|
|
|
link += "/"
|
|
|
|
genericHeader += '<li><a href="' + link + 'index.html">' + modd.name + '</a></li>\n'
|
|
|
|
genericHeader += '</ul>'
|
|
|
|
genericHeader += '</div>\n'
|
|
|
|
genericHeader += "<br/>\n"
|
|
|
|
genericHeader += "<br/>\n"
|
|
|
|
genericHeader += "<br/>\n"
|
|
|
|
genericHeader += "<br/>\n"
|
|
|
|
genericHeader += "<br/>\n"
|
|
|
|
genericHeader += "<br/>\n"
|
2013-12-22 18:55:48 +01:00
|
|
|
genericHeader += " </div>\n"
|
|
|
|
genericHeader += " </div>\n"
|
|
|
|
genericHeader += " <div class=\"container\" id=\"content\">\n"
|
|
|
|
|
|
|
|
genericFooter = " </div>\n"
|
|
|
|
genericFooter += "</body>\n"
|
|
|
|
genericFooter += "</html>\n"
|
|
|
|
|
|
|
|
# create index.hml :
|
|
|
|
generate_stupid_index_page(outFolder, genericHeader, genericFooter, myLutinDoc)
|
|
|
|
|
|
|
|
# create the namespace index properties :
|
|
|
|
generate_page(outFolder, genericHeader, genericFooter, myDoc)
|
|
|
|
|
2013-12-27 21:35:30 +01:00
|
|
|
for docInputName,outpath in myLutinDoc.listTutorialFile :
|
2013-12-22 18:55:48 +01:00
|
|
|
debug.print_element("doc", myLutinDoc.name, "<==", docInputName)
|
|
|
|
outputFileName = outFolder + "/" + outpath.replace('/','_') +".html"
|
|
|
|
debug.debug("output file : " + outputFileName)
|
|
|
|
monkTools.create_directory_of_file(outputFileName)
|
|
|
|
inData = monkTools.file_read_data(docInputName)
|
|
|
|
if inData == "":
|
|
|
|
continue
|
|
|
|
outData = genericHeader + codeBB.transcode(inData) + genericFooter
|
|
|
|
monkTools.file_write_data(outputFileName, outData)
|
|
|
|
|
2013-12-27 21:35:30 +01:00
|
|
|
for docInputName,outpath in myLutinDoc.listDocFile :
|
2013-12-22 18:55:48 +01:00
|
|
|
debug.print_element("tutorial", myLutinDoc.name, "<==", docInputName)
|
2013-12-27 21:35:30 +01:00
|
|
|
outputFileName = outFolder + outpath + ".html"
|
2013-12-22 18:55:48 +01:00
|
|
|
debug.debug("output file : " + outputFileName)
|
|
|
|
monkTools.create_directory_of_file(outputFileName)
|
|
|
|
inData = monkTools.file_read_data(docInputName)
|
|
|
|
if inData == "":
|
|
|
|
continue
|
|
|
|
outData = genericHeader + codeBB.transcode(inData) + genericFooter
|
|
|
|
monkTools.file_write_data(outputFileName, outData)
|
|
|
|
|
|
|
|
|
|
|
|
|