11from ruamel .yaml import YAML
2- from jinja2 import Environment , FileSystemLoader
32import sys
43import os
54from validate_yaml import validate_yaml , lint_yaml
@@ -172,6 +171,7 @@ def main(yaml_file):
172171 html_output = os .path .join (OUTPUT_DIR , f"{ base_filename } .html" )
173172
174173 if not write_html_content (html_output , html_content ):
174+ logging .error (f"Failed to write HTML content to { html_output } " )
175175 return None , None
176176
177177 logging .info (f"Cheatsheet generated: { html_output } " )
@@ -198,15 +198,17 @@ def generate_index(cheatsheets):
198198 cheatsheets .append ({"title" : title , "filename" : filename })
199199
200200 if cheatsheets :
201+ OUTPUT_DIR .mkdir (exist_ok = True , parents = True )
202+
201203 html_content = generate_index (cheatsheets )
202204 if html_content :
203205 index_output = os .path .join (OUTPUT_DIR , "index.html" )
204206 if write_html_content (index_output , html_content ):
205207 logging .info (f"Index page generated: { index_output } " )
206208 print (f"Generated cheatsheets for { len (cheatsheets )} YAML files." )
207209 else :
208- print ("Failed to write index page." )
210+ logging . error ("Failed to write index page." )
209211 else :
210- print ("Failed to generate index page." )
212+ logging . error ("Failed to generate index page." )
211213 else :
212214 print ("No valid cheatsheets were generated due to errors." )
0 commit comments