diff --git a/mindmap_gen/mindmap_gen.py b/mindmap_gen/mindmap_gen.py index 6f77c3e25d8b623130280738a7a241cdae796040..65b244ff7a2f3db1f45ebca92ebaecd4a0fdc2cd 100644 --- a/mindmap_gen/mindmap_gen.py +++ b/mindmap_gen/mindmap_gen.py @@ -52,7 +52,7 @@ class MarkdownParser: entries.append(Entry(dir_name, file_name, file_title, ref_count)) # Write entries to file - f = open("mindmap.md", "w") + f = open("mindmap_gen/mindmap.md", "w", encoding="utf8") f.write(self.generate_mindmap(entries)) f.close() @@ -69,14 +69,14 @@ class MarkdownParser: else: mm_str += (" - " + entry.get_title() + " (Refs: " + str(entry.get_refs()) + ")\n") else: - mm_str += (" - " + entry.get_dir() + "\n") + mm_str += (" - " + entry.get_dir().capitalize() + "\n") mm_str += (" - " + entry.get_title() + " (Refs: " + str(entry.get_refs()) + ")\n") prev_dir = entry.get_dir() return mm_str def get_md_file_title(self, md_file_path): - with open(md_file_path, 'r') as file: + with open(md_file_path, 'r', encoding="utf8") as file: data = file.read() return re.search("title: \"(.*)\"", data).group(1) @@ -92,7 +92,7 @@ class MarkdownParser: def get_md_ref_count(self, md_file_path): ref_regex = "\.\.\/refs#(.+)\)" - file_handle = open(md_file_path, mode='r') + file_handle = open(md_file_path, mode='r', encoding ="utf8") ref_count = 0 for line in file_handle.readlines():