From 386ea8cbdbf181f73a229e23222f6b7c89c68807 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 13 Feb 2021 18:52:54 +0000 Subject: [PATCH] pieces: Provide stroke_attrs_hook nfc Signed-off-by: Ian Jackson --- src/pieces.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pieces.rs b/src/pieces.rs index 943d83d7..86edd198 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -129,7 +129,7 @@ impl Outline for SimpleShape { impl Piece for SimpleShape { #[throws(IE)] fn svg_piece(&self, f: &mut Html, pri: &PieceRenderInstructions) { - self.svg_piece_raw(f, pri)?; + self.svg_piece_raw(f, pri, &mut |_|Ok(()))?; } fn describe_html(&self, face: Option) -> Html { Html(if_chain! { @@ -190,10 +190,10 @@ impl SimpleShape { } #[throws(IE)] - fn svg_piece_raw< - >(&self, f: &mut Html, pri: &PieceRenderInstructions, - ) - { + fn svg_piece_raw( + &self, f: &mut Html, pri: &PieceRenderInstructions, + stroke_attrs_hook: &mut dyn FnMut(&mut String) -> Result<(),IE>, + ) { let f = &mut f.0; let ef = |f: &mut String, cmap: &ColourMap, attrname: &str, otherwise| { if let Some(colour) = cmap.get(pri.face) { @@ -214,6 +214,7 @@ impl SimpleShape { if self.edges.len() != 0 { write!(f, r##" stroke-width="{}""##, &self.edge_width)?; } + stroke_attrs_hook(f)?; ef(f, &self.edges, "stroke", "")?; write!(f, r##" d="{}"/>"##, &self.path.0)?; } -- 2.30.2