diff --git a/.ci/generateIndex.py b/.ci/generateIndex.py index 162523568ff4c0aaef151d55b378371c089a6042..3d3f63726e3986b0fe0e3cb25bc75cd1b6cddef2 100644 --- a/.ci/generateIndex.py +++ b/.ci/generateIndex.py @@ -46,26 +46,23 @@ def save_legacy_from(localroot, root, filename): legacy_from = [] os.chdir(root) - # count the number of lines count = 0 - headerCheck = False legacy_from_flag = False with open(filename, 'r') as f: for line in f: count += 1 + # check for the start of the section if line[0:12] == "legacy_from:": legacy_from_flag = True - #legacy_from_line_start = count + # append lines from the legacy section if legacy_from_flag and line[0:12]: legacy_from.append(line) + # check for the end of the header if legacy_from_flag and line[0:3] == "---": - #legacy_from_line_end = count legacy_from_flag = False - print(legacy_from) - # change back to the local root os.chdir(localroot) @@ -160,7 +157,7 @@ for folder in cardDirs: if file[0] != "_": print(" > Generating header for: " + fileName) - # save legacy from + # save legacy section legacy_from = save_legacy_from(localroot, root, file) # remove the previous header @@ -195,6 +192,7 @@ for folder in cardDirs: header += " - /cards/" + root_handbook(shortcut) + "\n" header += " - /" + folder + "/cards/" + root_handbook(shortcut) + "\n" + # include the legacy section if len(legacy_from) > 0: for item in legacy_from: header += str(item)