From cc1ebfb82e73b6ac633dba4b3b791f8fb27869b5 Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Thu, 22 Sep 2022 11:31:03 +0200
Subject: [PATCH] minor changes

---
 core.py    | 5 +----
 library.py | 6 ++++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/core.py b/core.py
index 083ef84..0396e31 100644
--- a/core.py
+++ b/core.py
@@ -49,8 +49,6 @@ def core(cardDirs, localroot=os.getcwd()):
                                         name = library.save_tag(localroot, root, yml_file, "name")
                                         qms.prepare_qms(localroot, root, file)
 
-                                    print("title:" + title)
-
                                     # remove the previous header
                                     n = header.remove_header(localroot, root, file)
 
@@ -93,8 +91,7 @@ def core(cardDirs, localroot=os.getcwd()):
                                     format.line_prepender(fileName, h)
 
                                     localIndexArr[indexS].append(format.build_link(title, root))
-                                    print(title)
-                                    print(format.build_link(title, root))
+
                                     # output
                                     print(" + New header added.")
                                     print("-----------------------")
diff --git a/library.py b/library.py
index 57fd9ce..cda9354 100644
--- a/library.py
+++ b/library.py
@@ -83,6 +83,7 @@ def get_title(localroot, root, file):
 
     qms_yml = False
     yml_file = ""
+    title = ""
 
     if "policies" in root or "sops" in root:
         yml_file = file[:-3] + ".yml"
@@ -102,8 +103,9 @@ def get_title(localroot, root, file):
         os.chdir(localroot)
 
     # remove empty line from title
-    title = title.replace("# ", "")
-    title = title.rstrip("\n\r")
+    if len(title) > 0:
+        title = title.replace("# ", "")
+        title = title.rstrip("\n\r")
 
     return title, qms_yml, yml_file
 
-- 
GitLab