@@ -113,7 +113,10 @@ def generate_report(
113113 # Generate content for the subsection
114114 subsection_content , subsection_imports = (
115115 self ._generate_subsection (
116- subsection , is_report_static , is_report_revealjs
116+ subsection ,
117+ is_report_static ,
118+ is_report_revealjs ,
119+ static_dir = static_dir ,
117120 )
118121 )
119122 qmd_content .extend (subsection_content )
@@ -352,7 +355,11 @@ def _create_yaml_header(self) -> str:
352355 return yaml_header
353356
354357 def _generate_subsection (
355- self , subsection , is_report_static , is_report_revealjs
358+ self ,
359+ subsection ,
360+ is_report_static ,
361+ is_report_revealjs ,
362+ static_dir : str ,
356363 ) -> tuple [List [str ], List [str ]]:
357364 """
358365 Generate code to render components (plots, dataframes, markdown) in the given subsection,
@@ -366,6 +373,8 @@ def _generate_subsection(
366373 A boolean indicating whether the report is static or interactive.
367374 is_report_revealjs : bool
368375 A boolean indicating whether the report is in revealjs format.
376+ static_dir : str
377+ The folder where the static files will be saved.
369378 Returns
370379 -------
371380 tuple : (List[str], List[str])
@@ -389,11 +398,15 @@ def _generate_subsection(
389398
390399 if component .component_type == r .ComponentType .PLOT :
391400 subsection_content .extend (
392- self ._generate_plot_content (component , is_report_static )
401+ self ._generate_plot_content (
402+ component , is_report_static , static_dir = static_dir
403+ )
393404 )
394405 elif component .component_type == r .ComponentType .DATAFRAME :
395406 subsection_content .extend (
396- self ._generate_dataframe_content (component , is_report_static )
407+ self ._generate_dataframe_content (
408+ component , is_report_static , static_dir = static_dir
409+ )
397410 )
398411 elif (
399412 component .component_type == r .ComponentType .MARKDOWN
@@ -419,7 +432,7 @@ def _generate_subsection(
419432 return subsection_content , subsection_imports
420433
421434 def _generate_plot_content (
422- self , plot , is_report_static , static_dir : str = STATIC_FILES_DIR
435+ self , plot , is_report_static , static_dir : str
423436 ) -> List [str ]:
424437 """
425438 Generate content for a plot component based on the report type.
@@ -428,8 +441,8 @@ def _generate_plot_content(
428441 ----------
429442 plot : Plot
430443 The plot component to generate content for.
431- static_dir : str, optional
432- The folder where the static files will be saved (default is STATIC_FILES_DIR) .
444+ static_dir : str
445+ The folder where the static files will be saved.
433446
434447 Returns
435448 -------
@@ -561,7 +574,9 @@ def _generate_plot_code(self, plot, output_file="") -> str:
561574</div>\n """
562575 return plot_code
563576
564- def _generate_dataframe_content (self , dataframe , is_report_static ) -> List [str ]:
577+ def _generate_dataframe_content (
578+ self , dataframe , is_report_static , static_dir : str
579+ ) -> List [str ]:
565580 """
566581 Generate content for a DataFrame component based on the report type.
567582
@@ -571,6 +586,8 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
571586 The dataframe component to add to content.
572587 is_report_static : bool
573588 A boolean indicating whether the report is static or interactive.
589+ static_dir : str
590+ The folder where the static files will be saved.
574591
575592 Returns
576593 -------
@@ -620,7 +637,9 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
620637 )
621638
622639 # Display the dataframe
623- dataframe_content .extend (self ._show_dataframe (dataframe , is_report_static ))
640+ dataframe_content .extend (
641+ self ._show_dataframe (dataframe , is_report_static , static_dir = static_dir )
642+ )
624643
625644 except Exception as e :
626645 self .report .logger .error (
@@ -772,7 +791,7 @@ def _generate_image_content(
772791 )
773792
774793 def _show_dataframe (
775- self , dataframe , is_report_static , static_dir : str = STATIC_FILES_DIR
794+ self , dataframe , is_report_static , static_dir : str
776795 ) -> List [str ]:
777796 """
778797 Appends either a static image or an interactive representation of a DataFrame to the content list.
@@ -783,8 +802,8 @@ def _show_dataframe(
783802 The DataFrame object containing the data to display.
784803 is_report_static : bool
785804 Determines if the report is in a static format (e.g., PDF) or interactive (e.g., HTML).
786- static_dir : str, optional
787- The folder where the static files will be saved (default is STATIC_FILES_DIR) .
805+ static_dir : str
806+ The folder where the static files will be saved.
788807
789808 Returns
790809 -------
0 commit comments