def getfunctionsfile(filename): functionsfile = DocsFunctionsFile(0) functionsfile.name = filename functionsfile.new = 1 function = DocsFunction(0) for root, dirs, files in os.walk(os.path.join(documentation_root)): for name in files: file_split = os.path.splitext(name) if file_split[1]=='.markdown' and file_split[0] == filename+"_functions": f = open(os.path.join(root,name),'r') state = 'begin' linenum = 0 for line in f: line = line.decode("utf-8", "replace") if state == 'begin' and line.find('#functions') == 0: state = 'functionsfile' functionsfile.module = os.path.basename(root) functionsfile.new = False elif state == 'functionsfile' and line.find('##Description') == 0: state = 'filedescription' elif state == 'filedescription' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n': functionsfile.description = functionsfile.description + line elif state == 'filedescription' or state=='description' and line.find('###')==0: if(state=='description'): functionsfile.function_list.append(function) state = 'function' function = DocsFunction(0) elif state == 'function' and line.find('_')==0 and line.find('_description')==-1: #print "##########field: " + line addfield(function,line) elif state == 'function' and line.find('_description')==0: state = 'description' elif state == 'description' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n': function.description = function.description + line return functionsfile
def getfunctionsfile(filename): functionsfile = DocsFunctionsFile(0) functionsfile.name = filename functionsfile.new = 1 function = DocsFunction(0) for root, dirs, files in os.walk(os.path.join(documentation_root)): for name in files: file_split = os.path.splitext(name) if file_split[1]=='.markdown' and file_split[0] == filename+"_functions": f = open(os.path.join(root,name),'r') state = 'begin' linenum = 0 for line in f: if state == 'begin' and line.find('#functions') == 0: state = 'functionsfile' functionsfile.module = os.path.basename(root) functionsfile.new = False elif state == 'functionsfile' and line.find('##Description') == 0: state = 'filedescription' elif state == 'filedescription' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n': functionsfile.description = functionsfile.description + line elif state == 'filedescription' or state=='description' and line.find('###')==0: if(state=='description'): functionsfile.function_list.append(function) state = 'function' function = DocsFunction(0) elif state == 'function' and line.find('_')==0 and line.find('_description')==-1: #print "##########field: " + line addfield(function,line) elif state == 'function' and line.find('_description')==0: state = 'description' elif state == 'description' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n': function.description = function.description + line return functionsfile
def export_functionsfiles(db,group_dir,group): dbfiles = dbtools_files.list_all(db,group.id) for dbfile in dbfiles: functions = dbtools_functions.list_all(db,dbfile[0],'files') if len(functions)>0: print dbfile[1] functionsfile = DocsFunctionsFile(dbfile[0]) functionsfile.module = group.name functionsfile.name = dbfile[1] functionsfile.new = 0 functionsfile.advanced = False functionsfile.visible = True functionsfile.description = dbfile[2] functionsfile.addons = False functionsfile.function_list = functions for function in functions: print " " + function.name markdown_file.setfunctionsfile(functionsfile)
def getfunctionsfile(filename): functionsfile = DocsFunctionsFile(0) functionsfile.name = filename functionsfile.new = 1 function = DocsFunction(0) prevBreakLine = False for root, dirs, files in os.walk(os.path.join(documentation_root)): for name in files: file_split = os.path.splitext(name) if file_split[1] == '.markdown' and file_split[ 0] == filename + "_functions": f = open(os.path.join(root, name), 'rU') state = 'begin' linenum = 0 for line in f: line = line.decode("utf-8", "replace") if state == 'begin' and line.find('#functions') == 0: state = 'functionsfile' functionsfile.module = os.path.basename(root) functionsfile.new = False elif state == 'functionsfile' and line.find('_') == 0: addfield(functionsfile, line) elif state == 'functionsfile' and line.find( '##Description') == 0: state = 'filedescription' prevBreakLine = False elif state == 'filedescription' and line.find( '<!----------------------------------------------------------------------------->' ) == -1 and (line != '\n' or not prevBreakLine): functionsfile.description = functionsfile.description + line prevBreakLine = (line == '\n') elif state == 'filedescription' or state == 'description' and line.find( '###') == 0: if (state == 'description'): functionsfile.function_list.append(function) state = 'function' function = DocsFunction(0) elif state == 'function' and line.find( '_') == 0 and line.find('_description') == -1: #print "##########field: " + line addfield(function, line) elif state == 'function' and line.find( '_description') == 0: state = 'description' prevBreakLine = False elif state == 'description' and line.find( '<!----------------------------------------------------------------------------->' ) == -1 and (line != '\n' or not prevBreakLine): function.description = function.description + line prevBreakLine = (line == '\n') if (state == 'description'): functionsfile.function_list.append(function) functionsfile.function_list.sort(key=lambda function: function.name) return functionsfile
def getfunctionsfile(filename): functionsfile = DocsFunctionsFile(0) functionsfile.name = filename functionsfile.new = 1 function = DocsFunction(0) prevBreakLine = False for root, dirs, files in os.walk(os.path.join(documentation_root)): for name in files: file_split = os.path.splitext(name) if file_split[1] == ".markdown" and file_split[0] == filename + "_functions": f = open(os.path.join(root, name), "rU") state = "begin" linenum = 0 for line in f: line = line.decode("utf-8", "replace") if state == "begin" and line.find("#functions") == 0: state = "functionsfile" functionsfile.module = os.path.basename(root) functionsfile.new = False elif state == "functionsfile" and line.find("_") == 0: addfield(functionsfile, line) elif state == "functionsfile" and line.find("##Description") == 0: state = "filedescription" prevBreakLine = False elif ( state == "filedescription" and line.find( "<!----------------------------------------------------------------------------->" ) == -1 and (line != "\n" or not prevBreakLine) ): functionsfile.description = functionsfile.description + line prevBreakLine = line == "\n" elif state == "filedescription" or state == "description" and line.find("###") == 0: if state == "description": functionsfile.function_list.append(function) state = "function" function = DocsFunction(0) elif state == "function" and line.find("_") == 0 and line.find("_description") == -1: # print "##########field: " + line addfield(function, line) elif state == "function" and line.find("_description") == 0: state = "description" prevBreakLine = False elif ( state == "description" and line.find( "<!----------------------------------------------------------------------------->" ) == -1 and (line != "\n" or not prevBreakLine) ): function.description = function.description + line prevBreakLine = line == "\n" if state == "description": functionsfile.function_list.append(function) functionsfile.function_list.sort(key=lambda function: function.name) return functionsfile
def getfunctionsfile(filename): functionsfile = DocsFunctionsFile(0) functionsfile.name = filename functionsfile.new = 1 function = DocsFunction(0) prevBreakLine = False; for root, dirs, files in os.walk(os.path.join(documentation_root)): for name in files: file_split = os.path.splitext(name) if file_split[1]=='.markdown' and file_split[0] == filename+"_functions": functionsfile.path = name f = open(os.path.join(root,name),'rU') state = 'begin' linenum = 0 for line in f: #line = line.decode("utf-8", "replace") if state == 'begin' and line.find('#functions') == 0: state = 'functionsfile' functionsfile.module = os.path.basename(root) functionsfile.new = False elif state == 'functionsfile' and line.find('_')==0: addfield(functionsfile,line) elif state == 'functionsfile' and line.find('##Description') == 0: state = 'filedescription' prevBreakLine = False elif state == 'filedescription' and line.find('<!----------------------------------------------------------------------------->')==-1 and (line!='\n' or not prevBreakLine): functionsfile.description = functionsfile.description + line prevBreakLine = (line=='\n') elif state == 'filedescription' or state=='description' and line.find('###')==0: if(state=='description'): functionsfile.function_list.append(function) state = 'function' function = DocsFunction(0) elif state == 'function' and line.find('_')==0 and line.find('_inlined_description')==-1 and line.find('_description')==-1: #print "##########field: " + line addfield(function,line) elif state == 'function' and line.find('_inlined_description')==0: state = 'inlined_description' prevBreakLine = True elif (state == 'inlined_description' or state=='function') and line.find('_description')==0: state = 'description' prevBreakLine = False elif state == 'inlined_description' and line.find('##')!=0 and line.find('_description')==-1 and (line!='\n' or not prevBreakLine): function.inlined_description = function.inlined_description + line prevBreakLine = (line=='\n') elif state == 'description' and line.find('<!----------------------------------------------------------------------------->')==-1 and (line!='\n' or not prevBreakLine): function.description = function.description + line prevBreakLine = (line=='\n') if(state=='description'): functionsfile.function_list.append(function) functionsfile.function_list.sort(key=lambda function: function.syntax) return functionsfile