Generate render link based on path to file.

This commit is contained in:
Tom Alexander
2025-02-08 18:59:45 -05:00
parent 3e952ef0f4
commit ff478253c3
4 changed files with 118 additions and 80 deletions

View File

@@ -143,7 +143,29 @@ impl LinkTarget {
.unwrap_or_default(),
target_id
))),
LinkTarget::Image { src, .. } => Ok(Some(src.clone())),
LinkTarget::Image { src, .. } => {
let path_to_file = render_context
.dependency_manager
.lock()
.unwrap()
.get_current_folder()?
.join(src)
.canonicalize()?;
let input_root_directory = render_context.config.get_root_directory();
let relative_path_to_file = path_to_file.strip_prefix(input_root_directory)?;
dbg!(input_root_directory);
dbg!(&path_to_file);
dbg!(relative_path_to_file);
let web_path = get_web_path(
render_context.config,
render_context.output_root_directory,
render_context.output_file,
relative_path_to_file,
)?;
dbg!(&web_path);
// TODO: Record interest in copying the file to output.
Ok(Some(web_path))
}
}
}