From: Ian Jackson Date: Sun, 15 May 2022 15:58:34 +0000 (+0100) Subject: shapelib subst: Reorder other settings X-Git-Tag: otter-1.1.0~100 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ad0b26fe118073ecf748e2082db3d268017f4205;p=otter.git shapelib subst: Reorder other settings This lets the explicit substs from various places override the builtin image and colour. Signed-off-by: Ian Jackson --- diff --git a/src/shapelib.rs b/src/shapelib.rs index 7de6d813..a5ae6ba5 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -1440,9 +1440,8 @@ fn process_files_entry( let item_name = subst_item_name(&format_item_name( mformat, &magic.item_prefix, &fe, &magic.item_suffix)?)?; - let spec = Substituting::new(mformat, Dollars::Text, &magic.template); - let spec = substn(spec, "${image}", &image_table)?; - let mut spec = c_colour_all(spec.into())?.is_y()?; + let mut spec = Substituting::new(mformat, Dollars::Text, + &magic.template); for (k,v) in chain!{ c_substs.into_iter().map(IntoIterator::into_iter).flatten(), &magic.substs, @@ -1450,6 +1449,8 @@ fn process_files_entry( } { spec = substn(spec, format!("${{{}}}", k), v)?; } + let spec = substn(spec, "${image}", &image_table)?; + let spec = c_colour_all(spec.into())?.is_y()?; let spec = spec.finish()?; trace!("magic item {}\n\n{}\n", &item_name, &spec);