Skip to content

Commit 28d5342

Browse files
committed
Make deferred processing work with 'attr' option
1 parent aa37f3d commit 28d5342

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,13 @@ fn process_event(event: &Event, mut state: &mut State) -> Step {
710710
if !allow_iteration(&table.columns[i], &state.settings) { return Step::Next; }
711711
if let Some("last") = table.columns[i].aggr { table.columns[i].value.borrow_mut().clear(); }
712712
}
713-
table.columns[i].value.borrow_mut().push_str(value)
713+
if i == 0 { table.lastid.borrow_mut().push_str(value); }
714+
if let (Some(s), Some(r)) = (table.columns[i].find, table.columns[i].replace) {
715+
table.columns[i].value.borrow_mut().push_str(&value.replace(s, r));
716+
}
717+
else { table.columns[i].value.borrow_mut().push_str(value); }
714718
}
715719
else if !state.settings.hush_warning { eprintln!("Warning: failed to decode attribute {} for column {}", request, table.columns[i].name); }
716-
return Step::Next;
717720
}
718721
}
719722
else if !state.settings.hush_warning { eprintln!("Warning: failed to decode an attribute for column {}", table.columns[i].name); }
@@ -723,10 +726,7 @@ fn process_event(event: &Event, mut state: &mut State) -> Step {
723726
if table.columns[i].value.borrow().is_empty() && !state.settings.hush_warning {
724727
eprintln!("Warning: column {} requested attribute {} not found", table.columns[i].name, request);
725728
}
726-
if let (Some(s), Some(r)) = (table.columns[i].find, table.columns[i].replace) {
727-
let mut value = table.columns[i].value.borrow_mut();
728-
*value = value.replace(s, r);
729-
}
729+
return Step::Next;
730730
}
731731
// Set the appropriate convert flag for the following data in case the 'conv' option is present
732732
match table.columns[i].convert {

0 commit comments

Comments
 (0)