chiark / gitweb /
shapelib subst: Reorder other settings
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 May 2022 15:58:34 +0000 (16:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 May 2022 20:41:22 +0000 (21:41 +0100)
This lets the explicit substs from various places override the builtin
image and colour.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/shapelib.rs

index 7de6d81375803a4c40c583b7a7409b8389548d06..a5ae6ba5d47c63b93de05c3a5028546036244712 100644 (file)
@@ -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);