[DEV] add documantation capabilities
This commit is contained in:
parent
8659f3f133
commit
70423434d8
64
lutinDoc.py
64
lutinDoc.py
@ -8,6 +8,8 @@ sys.path.append(lutinTools.GetCurrentPath(__file__) + "/cppParser/CppHeaderParse
|
||||
import CppHeaderParser
|
||||
import lutinDocHtml
|
||||
import lutinDocMd
|
||||
import os
|
||||
import fnmatch
|
||||
|
||||
##
|
||||
## @brief Main Documantion class
|
||||
@ -22,6 +24,60 @@ class doc:
|
||||
self.listFunction = dict()
|
||||
self.listNamepsaces = dict()
|
||||
self.target = None
|
||||
self.webSite = ""
|
||||
self.pathParsing = ""
|
||||
self.externalLink = []
|
||||
self.title = moduleName + " Library"
|
||||
self.styleHtml = ""
|
||||
|
||||
##
|
||||
## @brief Set the module website (activate only when compile in release mode, else "../moduleName/)
|
||||
## @param[in] url New Website url
|
||||
##
|
||||
def set_website(self, url):
|
||||
self.webSite = url
|
||||
|
||||
##
|
||||
## @brief set the parsing folder
|
||||
## @param[in] path New path to parse
|
||||
##
|
||||
def set_path(self, path):
|
||||
self.pathParsing = path
|
||||
|
||||
##
|
||||
## @brief List of validate external library link (disable otherwise)
|
||||
## @param[in] availlable List of all module link availlable
|
||||
##
|
||||
def set_external_link(self, availlable):
|
||||
self.externalLink = availlable
|
||||
|
||||
##
|
||||
## @brief Set the library title
|
||||
## @param[in] title New title to set.
|
||||
##
|
||||
def set_title(self, title):
|
||||
self.title = title
|
||||
|
||||
##
|
||||
## @brief new html basic css file
|
||||
## @param[in] file File of the css style sheet
|
||||
##
|
||||
def set_html_css(self, cssFile):
|
||||
self.styleHtml = cssFile
|
||||
|
||||
|
||||
##
|
||||
## @brief Create the module documentation:
|
||||
## @param[in,out] target target that request generation of the documentation
|
||||
##
|
||||
def doc_parse_code(self):
|
||||
for root, dirnames, filenames in os.walk(self.pathParsing):
|
||||
tmpList = fnmatch.filter(filenames, "*.h")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
fileCompleteName = os.path.join(root, filename)
|
||||
debug.debug(" Find a file : '" + fileCompleteName + "'")
|
||||
self.add_file(fileCompleteName)
|
||||
|
||||
##
|
||||
## @brief Add a File at the parsing system
|
||||
@ -52,10 +108,12 @@ class doc:
|
||||
|
||||
# add all enums:
|
||||
for localEnum in metaData.enums:
|
||||
if localEnum['namespace'] == '':
|
||||
enumName = localEnum['name']
|
||||
if "name" not in localEnum.keys():
|
||||
continue
|
||||
if localEnum["namespace"] == "":
|
||||
enumName = localEnum["name"]
|
||||
else:
|
||||
enumName = localEnum['namespace'] + "::" + localEnum['name']
|
||||
enumName = localEnum["namespace"] + "::" + localEnum['name']
|
||||
enumName = enumName.replace("::::", "::")
|
||||
if enumName in self.listEnum.keys():
|
||||
debug.warning("Might merge enum : '" + enumName + "' file : " + filename)
|
||||
|
@ -34,8 +34,7 @@ class module:
|
||||
self.name=moduleName
|
||||
# Dependency list:
|
||||
self.depends=[]
|
||||
# Dependency list:
|
||||
self.docPath = ""
|
||||
# Documentation list:
|
||||
self.documentation = None
|
||||
# export PATH
|
||||
self.export_path=[]
|
||||
@ -380,34 +379,30 @@ class module:
|
||||
## @brief Set the documentation availlable for this module
|
||||
##
|
||||
def doc_enable(self):
|
||||
self.docPath = lutinTools.GetCurrentPath(self.originFile)
|
||||
self.documentation = lutinDoc.doc(self.name)
|
||||
self.documentation.set_path(lutinTools.GetCurrentPath(self.originFile))
|
||||
|
||||
##
|
||||
## @brief Create the module documentation:
|
||||
## @param[in,out] target target that request generation of the documentation
|
||||
##
|
||||
def doc_parse_code(self, target):
|
||||
if self.docPath == "":
|
||||
if self.documentation == None:
|
||||
return False
|
||||
for root, dirnames, filenames in os.walk(self.docPath):
|
||||
tmpList = fnmatch.filter(filenames, "*.h")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
fileCompleteName = os.path.join(root, filename)
|
||||
debug.debug(" Find a file : '" + fileCompleteName + "'")
|
||||
self.documentation.add_file(fileCompleteName)
|
||||
self.documentation.doc_parse_code()
|
||||
return True
|
||||
|
||||
##
|
||||
## @brief Generate real documentation files
|
||||
## @param[in,out] target target that request generation of the documentation
|
||||
##
|
||||
def doc_generate(self, target):
|
||||
if self.docPath == "":
|
||||
if self.documentation == None:
|
||||
return False
|
||||
# Real creation of the documentation :
|
||||
lutinTools.RemoveFolderAndSubFolder(target.GetDocFolder(self.name));
|
||||
self.documentation.generate_documantation(target, target.GetDocFolder(self.name))
|
||||
return True
|
||||
|
||||
|
||||
##
|
||||
@ -416,7 +411,7 @@ class module:
|
||||
## @return [real element name, link on it]
|
||||
##
|
||||
def doc_get_link(self, target, elementName):
|
||||
if self.docPath == "":
|
||||
if self.documentation == None:
|
||||
return [elementName, ""]
|
||||
return self.documentation.get_class_link_from_target(elementName);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user