@@ -226,6 +226,11 @@ def get_test_results(categorized_plots):
226226
227227 return test_results
228228
229+ def _relative_plot_path (plot_file , output_dir ):
230+ """Compute the relative path from the report output directory to a plot file."""
231+ rel = os .path .relpath (plot_file , output_dir ).replace ('\\ ' , '/' )
232+ return rel .replace (' ' , '%20' )
233+
229234def generate_markdown_report (categorized_plots , output_dir , build_dir , html_styling = False ):
230235 """Generate the markdown report content."""
231236
@@ -358,10 +363,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
358363 content .append ("" )
359364 for plot_file in model_plots ['decay' ]:
360365 plot_name = plot_file .stem .replace ('_' , ' ' ).replace ('comparison' , '' ).strip ()
361- # Create path relative to report directory
362- relative_path = f"../{ model } /results/plots/{ plot_file .name } "
363- relative_path = relative_path .replace ('\\ ' , '/' )
364- relative_path = relative_path .replace (' ' , '%20' )
366+ relative_path = _relative_plot_path (plot_file , output_dir )
365367
366368 test_type = "Decay Test"
367369 # Get the actual test status
@@ -392,9 +394,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
392394 content .append ("" )
393395 for plot_file in model_plots ['regular_waves' ]:
394396 plot_name = plot_file .stem .replace ('_' , ' ' ).replace ('comparison' , '' ).strip ()
395- relative_path = f"../{ model } /results/plots/{ plot_file .name } "
396- relative_path = relative_path .replace ('\\ ' , '/' )
397- relative_path = relative_path .replace (' ' , '%20' )
397+ relative_path = _relative_plot_path (plot_file , output_dir )
398398
399399 # Extract wave number if present
400400 wave_num = ""
@@ -433,9 +433,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
433433 content .append ("" )
434434 for plot_file in model_plots ['irregular_waves' ]:
435435 plot_name = plot_file .stem .replace ('_' , ' ' ).replace ('comparison' , '' ).strip ()
436- relative_path = f"../{ model } /results/plots/{ plot_file .name } "
437- relative_path = relative_path .replace ('\\ ' , '/' )
438- relative_path = relative_path .replace (' ' , '%20' )
436+ relative_path = _relative_plot_path (plot_file , output_dir )
439437
440438 test_type = "Irregular Waves"
441439 # Get the actual test status
@@ -466,9 +464,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
466464 content .append ("" )
467465 for plot_file in model_plots ['other' ]:
468466 plot_name = plot_file .stem .replace ('_' , ' ' ).replace ('comparison' , '' ).strip ()
469- relative_path = f"../{ model } /results/plots/{ plot_file .name } "
470- relative_path = relative_path .replace ('\\ ' , '/' )
471- relative_path = relative_path .replace (' ' , '%20' )
467+ relative_path = _relative_plot_path (plot_file , output_dir )
472468
473469 test_type = "Other Test"
474470 # Get the actual test status (try to infer from filename)
0 commit comments