예제 #1
0
def coll_data(keywords, documentation, num, helpdir, fname, sli_command_list):
    """
    Collect data.

    Prepare the data for writing the help.
    """
    see = ""
    relfile = fname.strip()
    doc_dic = {"Id": str(num), "File": relfile}
    iname = None
    for k in keywords:
        if k in documentation:
            if k == "Name:":
                iname = documentation[k].split()[0].rstrip("-")
                ifullname = documentation[k].strip(" \n").strip()
                ifullname = ifullname.lstrip(iname).strip()
                ifullname = ifullname.lstrip("- ")
                if iname:
                    iname = iname.strip('~~')
                    doc_dic.update({"Name": iname})
                if ifullname:
                    doc_dic.update({"FullName": ifullname})
            elif k == "SeeAlso:" or k == "See also:" or k == "See Also:":
                doc_list = []
                see_alsos = cut_it(",", documentation[k])
                for i in see_alsos:
                    see = i.strip()
                    if see:
                        doc_list.append(see)
                doc_dic.update({"SeeAlso": doc_list})
            else:
                text = ""
                name = k.replace(":", "")
                for i in cut_it("\n", documentation[k]):
                    text = text + i.strip() + " \n" + ""
                if text:
                    doc_dic.update({name: text})
    write_help_html(doc_dic, helpdir, fname, sli_command_list, keywords)
예제 #2
0
def coll_data(keywords, documentation, num, helpdir, fname, sli_command_list):
    """
    Collect data.

    Prepare the data for writing the help.
    """
    see = ""
    relfile = fname.strip()
    doc_dic = {"Id": str(num), "File": relfile}
    iname = None
    for k in keywords:
        if k in documentation:
            if k == "Name:":
                iname = documentation[k].split()[0].rstrip("-")
                ifullname = documentation[k].strip(" \n").strip()
                ifullname = ifullname.lstrip(iname).strip()
                ifullname = ifullname.lstrip("- ")
                if iname:
                    iname = iname.strip('~~')
                    doc_dic.update({"Name": iname})
                if ifullname:
                    doc_dic.update({"FullName": ifullname})
            elif k == "SeeAlso:" or k == "See also:" or k == "See Also:":
                doc_list = []
                see_alsos = cut_it(",", documentation[k])
                for i in see_alsos:
                    see = i.strip()
                    if see:
                        doc_list.append(see)
                doc_dic.update({"SeeAlso": doc_list})
            else:
                text = ""
                name = k.replace(":", "")
                for i in cut_it("\n", documentation[k]):
                    text = text + i.strip() + " \n" + ""
                if text:
                    doc_dic.update({name: text})
    write_help_html(doc_dic, helpdir, fname, sli_command_list, keywords)
예제 #3
0
# compile the sli command list
for fname in allfiles:
    if fname.endswith('.sli'):
        f = io.open(fname, encoding='utf-8')
        filetext = f.read()
        f.close()
        items = re.findall(dcs, filetext, re.DOTALL)
        for item in items:
            for line in item.splitlines():
                name_line = re.findall(r"([\s*]?Name[\s*]?\:)(.*)", line)
                if name_line:
                    # Clean the Name: line!
                    name_line_0 = name_line[0][0].strip()
                    name_line_1 = name_line[0][1].strip()
                    sliname = cut_it(' - ', name_line_1)[0]
                    sli_command_list.append(sliname)

dcs = r'\/\*[(\*|\s)?]*[\n?]*@BeginDocumentation' \
      r'[\s?]*\:?[\s?]*[.?]*\n(.*?)\n*?\*\/'

for fname in allfiles:
    # .py is for future use
    if not fname.endswith('.py'):
        f = io.open(fname, encoding='utf-8')
        filetext = f.read()
        f.close()
        # Multiline matching to find codeblock
        items = re.findall(dcs, filetext, re.DOTALL)

        for item in items:
예제 #4
0
# searching for a sli_command_list
for file in allfiles:
    if file.endswith('.sli'):
        f = open(file, 'r')
        filetext = f.read()
        f.close()
        items = re.findall(dcs, filetext, re.DOTALL)
        for item in items:
            for line in item.splitlines():
                name_line = re.findall(r"([\s*]?Name[\s*]?\:)(.*)", line)
                if name_line:
                    if name_line:
                        # Clean the Name: line!
                        name_line_0 = name_line[0][0].strip()
                        name_line_1 = name_line[0][1].strip()
                        sliname = cut_it(' - ', name_line_1)[0]
                        sli_command_list.append(sliname)

# Now begin to collect the data for the help files and start generating.
dcs = r'\/\*[\s?]*[\n?]*BeginDocumentation[\s?]*\:?[\s?]*[.?]*\n(.*?)\n*?\*\/'
for fname in allfiles:
    # .py is for future use
    if not fname.endswith('.py'):
        f = open(fname, 'r')
        filetext = f.read()
        f.close()
        # Multiline matching to find codeblock
        items = re.findall(dcs, filetext, re.DOTALL)
        for item in items:
            # Check the ifdef in code
            require = check_ifdef(item, filetext, dcs)