diff --git a/.ci/generateIndex.py b/.ci/generateIndex.py index abff9642f8b1b9fa15315d5455ecce1c73ce09f0..c27d9bd39bb57328125775e64ae6114be2688530 100644 --- a/.ci/generateIndex.py +++ b/.ci/generateIndex.py @@ -49,7 +49,6 @@ def save_order(localroot, root, filename): with open(filename, 'r') as f: for line in f: # check for the start of the section - #print(line) if line[0:6] == "order:": order = line[7:] break @@ -59,6 +58,19 @@ def save_order(localroot, root, filename): return order.rstrip() +def get_ignore(): + return ["404.html", + "Gemfile", + "Gemfile.lock", + "README.md", + "_config.yml", + "_site", + "assets", + "help.md", + "index.md", + "pagination.md" + ] + def save_legacy_from(localroot, root, filename): legacy_from = [] os.chdir(root) @@ -124,6 +136,8 @@ def remove_header(localroot, root, filename): # loop through the entire internal tree localroot = os.getcwd() +# retrieve ignore list +ignore = get_ignore() # generate the index properly speaking cardDirs = ["internal", "external", "policies"] @@ -136,7 +150,7 @@ for direct in cardDirs: dirs = natsorted(dirs) for d in dirs: - if d[0] != ".": + if d[0] != "." and d not in ignore: sections.append(d) sections = list(set(sections)) @@ -149,17 +163,18 @@ whiteList = '' localIndexArr = [[]] * len(sections) orderArr = [[]] * len(sections) + for folder in cardDirs: # FolderFlag gets set to true at the first iteration folderFlag = True # check if folder exists - if path.isdir(folder): + if path.isdir(folder) and folder not in ignore: dirs = os.listdir(folder) dirs = natsorted(dirs) for d in dirs: - if d[0] != ".": + if d[0] != "." and d not in ignore: # set the header of the section #index += "\n### " + d.replace("-", " ").capitalize() + "\n" @@ -167,7 +182,6 @@ for folder in cardDirs: indexS = sections.index(d) maxOrder = 0 - #print(indexS) if len(localIndexArr[indexS]) == 0: localIndexArr[indexS] = ["\n"]