From 9b268387bc40d67f994831594e7cf8d22f89260d Mon Sep 17 00:00:00 2001 From: Naseer Dari Date: Tue, 27 Feb 2024 18:10:17 -0600 Subject: [PATCH] Enhance PDF generation - Add sorting to the folders - Fix the regex to add files with uppercase letters in their names --- ...io-implement-authentication-and-authorization-solutions.md | 2 +- security-plus-all.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md b/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md index d3eaac0..3e4c37b 100644 --- a/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md +++ b/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md @@ -1,4 +1,4 @@ -# 3.8 +# 3.8 Given a scenario implement authentication and authorization solutions ## Authentication management diff --git a/security-plus-all.py b/security-plus-all.py index 10a0c95..7e9683d 100755 --- a/security-plus-all.py +++ b/security-plus-all.py @@ -14,9 +14,10 @@ def generate_security_plus_file(): with open(markdown_file, "w") as f: f.write("# **CompTIA Security+ (SY0-601)**\n\n") folders = [f for f in os.listdir() if os.path.isdir(f) and re.match(r"\d\.\d-[a-z-]+", f)] + folders = sorted(folders) for folder in folders: folder_path = os.path.join(os.getcwd(), folder) - files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f)) and re.match(r"\d+\.\d+-[a-z-]+\.md", f)] + files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f)) and re.match(r"\d+\.\d+-[a-zA-Z-]+\.md", f)] files = sorted(files) if files: folder_title = "-".join(folder.split("-")[1:]).replace("-", " ").title() @@ -24,6 +25,7 @@ def generate_security_plus_file(): for file in files: with open(os.path.join(folder_path, file), "r") as fp: f.write(fp.read() + "\n") + f.write("\n") if __name__ == "__main__": generate_security_plus_file()