@@ -101,6 +101,12 @@ def parse_functions(self):
101
101
for issue in type_info ['issues' ]:
102
102
issue ['description_html' ] = utils .to_html (issue ['description' ], single_paragraph = True )
103
103
104
+ if 'preview_images' in type_info :
105
+ function ["has_preview_image" ] = True
106
+ for preview_img in type_info ['preview_images' ]:
107
+ if 'description' in preview_img :
108
+ preview_img ['description_html' ] = utils .to_html (preview_img ['description' ], single_paragraph = True )
109
+
104
110
if ('returns' in type_info ) and ('description' in type_info ['returns' ]):
105
111
type_info ['returns' ]['description_html' ] = utils .to_html (type_info ['returns' ]['description' ], single_paragraph = True )
106
112
@@ -190,17 +196,15 @@ def parse_function_preview_images(self, function):
190
196
base_name = os .path .basename (real_path )
191
197
output_path = os .path .join (preview_images_folder , base_name )
192
198
193
- # Ignore if destination file already exists
194
- if os .path .exists (output_path ):
195
- continue
196
-
197
- shutil .copyfile (real_path , output_path )
198
- self .logger .info (f"Created function preview image { output_path } " )
199
+ # Copy only if not already copied
200
+ if not os .path .exists (output_path ):
201
+ shutil .copyfile (real_path , output_path )
202
+ self .logger .info (f"Created function preview image { output_path } " )
199
203
200
204
preview_images [type_name ].append ({
201
205
'real_path' : real_path ,
202
206
'path_html' : f"/function_images/{ base_name } " ,
203
- 'description' : preview_img .get ('description' ),
207
+ 'description' : preview_img .get ('description' , '' ),
204
208
})
205
209
type_info ['preview_images' ] = preview_images [type_name ]
206
210
0 commit comments