this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: extract_img_names normalizes #image("images/name.ext") to bare stem

Previously returned the full path string, causing src mismatch with sidecar
rects which store bare stems. Now strips "images/" prefix and extension for
both #img() and #image() forms.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

+9 -2
+9 -2
crates/tala/src/main.rs
··· 256 256 } 257 257 258 258 /// Extract image source arguments in document order from a fragment. 259 + /// Always returns bare stems (no path prefix, no extension) so they match sidecar `src` fields. 259 260 /// Handles both `#img("name")` (custom shorthand) and `#image("path")` (native typst). 260 261 fn extract_img_names(source: &str) -> Vec<String> { 261 262 let mut names = Vec::new(); 262 263 let mut rest = source; 263 264 while !rest.is_empty() { 264 - // Find the next #img( or #image( occurrence. 265 265 let img_pos = rest.find("#img(\""); 266 266 let image_pos = rest.find("#image(\""); 267 267 let (pos, skip) = match (img_pos, image_pos) { ··· 272 272 }; 273 273 rest = &rest[pos + skip..]; 274 274 if let Some(end) = rest.find('"') { 275 - names.push(rest[..end].to_string()); 275 + let raw = &rest[..end]; 276 + // Normalize to bare stem: strip leading "images/" and trailing extension. 277 + let after_prefix = raw.strip_prefix("images/").unwrap_or(raw); 278 + let stem = std::path::Path::new(after_prefix) 279 + .file_stem() 280 + .and_then(|s| s.to_str()) 281 + .unwrap_or(after_prefix); 282 + names.push(stem.to_string()); 276 283 rest = &rest[end + 1..]; 277 284 } 278 285 }