Skip to content

Commit cc8626a

Browse files
authored
Merge pull request #88 from CSA-FEDERATE/Excel_generation_rework
Modifying output script to include path to each BB in output file
2 parents 5248bb9 + c7ad2a3 commit cc8626a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

other/scripts/output_file_generator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def extract_headings_and_content(file_path, is_template_file = False):
6767
"""
6868
name_pattern = re.compile(r"# ([a-zA-Z0-9., +\-\ \/(\)]*)\s*## BB Tag")
6969
heading_pattern = re.compile(r"## ([a-zA-Z +\-\/\(\)]*)")
70+
file_path_pattern = re.compile(r"(?:Proposed-BuildingBlocks\\)(.*)")
7071

7172
with open(file_path, "r", encoding="utf-8") as file:
7273
content = file.read()
@@ -78,11 +79,16 @@ def extract_headings_and_content(file_path, is_template_file = False):
7879
if not names:
7980
raise ValueError(f"No BB Name found in {file_path}")
8081

82+
#add file path to output file
83+
path = file_path_pattern.findall(file_path)[0]
84+
#remove file type
85+
path = path.replace(".md","")
86+
8187
implementation_status = 'implementation exists'
8288
if "WorkInProgress" in file_path:
8389
implementation_status = 'suggested'
8490

85-
heading_contents = {"BB Name": names[0], "Implementation Status":implementation_status}
91+
heading_contents = {"BB Name": names[0], "BB Path": path, "Implementation Status": implementation_status}
8692

8793
for i, heading in enumerate(headings):
8894
if heading not in template_headings and not is_template_file:

0 commit comments

Comments
 (0)