예제 #1
0
def OPS_to_acn(script_path, repopath, filelist):
    mdlist = [
        repopath + "/" + x.strip() for x in filelist
        if x.strip()[len(x.strip()) - 3:] == ".md"
    ]
    get_all_articles_path(repopath)
    for filepath in mdlist:
        OPS_to_acn_one_path(filepath, repopath, script_path)
    return
예제 #2
0
def OPS_to_acn_smartgit(script_path, repopath, filelist_temp):
    file = open(filelist_temp, "r")
    filelist = file.readlines()
    file.close()
    repopath = repopath.replace("\\", "/")
    mdlist = [
        x.strip() for x in filelist if x.strip()[len(x.strip()) - 3:] == ".md"
    ]
    get_all_articles_path(repopath)
    for filepath in mdlist:
        OPS_to_acn_one_path(filepath, repopath, script_path)
    return
예제 #3
0
def fitOPS_main_smartgit(script_path, repopath, filelist_temp, acompath):
    """
    This is main function for converting multiple files from ACN
    content to OPS content. After the converting is finished, the
    file will be overwritten. It is called by SmartGit.

    ============================================
    Parameters
    ----------------------------------------------------------------------

    filelist_temp - The path of a temp file that is storing the absolute
               path list of files that are going to be converted.

    repopath - The root path of the repo the file is in. This is needed,
               because we need to convert a "/documentation/articles/xxx/"
               link to a relative path link.

    acompath - The root path of the ACOM repo. This is needed, because we
               need to fill back the programming languages of some code
               blocks, and ACOM repo is the source where we can find those
               programming languages.

    script_path - The root path of this script project. This is needed,
               because the script is usually called in Source Tree or
               SmartGit. The current path is the repo root path, not the 
               root path of this project. However, we still need to read
               the file within this project, hence this parameter is
               needed.
    """
    file = open(filelist_temp, "r")
    filelist = file.readlines()
    file.close()
    repopath = repopath.replace("\\", "/")
    mdlist = [
        x.strip() for x in filelist if x.strip()[len(x.strip()) - 3:] == ".md"
    ]
    get_all_articles_path(repopath)
    for filepath in mdlist:
        print("Proccessing: " + filepath)
        fitOPS(filepath, repopath, acompath, script_path)
    update_acom_files_path(script_path)
    return
예제 #4
0
    filelist = file.readlines()
    file.close()
    repopath = repopath.replace("\\", "/")
    mdlist = [
        x.strip() for x in filelist if x.strip()[len(x.strip()) - 3:] == ".md"
    ]
    get_all_articles_path(repopath)
    for filepath in mdlist:
        print("Proccessing: " + filepath)
        fitOPS(filepath, repopath, acompath, script_path)
    update_acom_files_path(script_path)
    return


if __name__ == '__main__':
    get_all_articles_path("E:/GitHub/techcontent/")

    for v, k in all_articles_path.items():
        print("Processing: " + k)
        fitOPS(k)
    for k in glob.iglob("E:/GitHub/techcontent/includes/*.md"):
        k = k.replace("\\", "/")
        print("Processing: " + k)
        fitOPS(k)
    mdList = glob.glob("E:/GitHub/techcontent/develop/**/*.md")
    mdList.extend(glob.glob("E:/GitHub/techcontent/develop/*.md"))
    mdList.extend(glob.glob("E:/GitHub/techcontent/develop/**/**/*.md"))
    mdList.extend(glob.glob("E:/GitHub/techcontent/develop/**/**/**/*.md"))
    for k in mdList:
        k = k.replace("\\", "/")
        print("Processing: " + k)