Skip to content
Snippets Groups Projects
Verified Commit 39b6f3ed authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

introduce ignore list for headers

parent 11750294
No related branches found
No related tags found
No related merge requests found
......@@ -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"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment