From 103d1570de3125418f7b7e4f66c038c532f1eae3 Mon Sep 17 00:00:00 2001 From: Dominique RIGHETTO Date: Fri, 11 Jan 2019 15:10:15 +0100 Subject: [PATCH] Fix error in index script --- Index.md | 2 +- scripts/Update_CheatSheets_Index.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Index.md b/Index.md index 466ebfbc4c..4d45a43475 100644 --- a/Index.md +++ b/Index.md @@ -1,4 +1,4 @@ -**14** cheat sheets available. +**32** cheat sheets available. *Icons beside the cheat sheet name indicate in which language(s) code snippet(s) are provided.* diff --git a/scripts/Update_CheatSheets_Index.py b/scripts/Update_CheatSheets_Index.py index cc4c06b169..090cbdca4a 100644 --- a/scripts/Update_CheatSheets_Index.py +++ b/scripts/Update_CheatSheets_Index.py @@ -31,6 +31,7 @@ def extract_languages_snippet_provided(cheatsheet): # Scan all CS files index = {} +cs_count = 0 cheatsheets = [f.name for f in os.scandir("../cheatsheets") if f.is_file()] for cheatsheet in cheatsheets: letter = cheatsheet[0].upper() @@ -38,12 +39,13 @@ def extract_languages_snippet_provided(cheatsheet): index[letter] = [cheatsheet] else: index[letter].append(cheatsheet) + cs_count += 1 index = OrderedDict(sorted(index.items())) # Generate the index file with open("../Index.md", "w") as index_file: index_count = len(index) - index_file.write(cs_count_template % index_count) + index_file.write(cs_count_template % cs_count) index_file.write("\n\n*Icons beside the cheat sheet name indicate in which language(s) code snippet(s) are provided.*") index_file.write("\n\n") # Generate the top menu