From 71d5a97a117425aac577afeb449f7c4b196b88d0 Mon Sep 17 00:00:00 2001 From: Wout Date: Sat, 15 Nov 2025 12:12:37 +0100 Subject: [PATCH 1/2] Allow passing arbitrary arguments for attributes to svg inliner --- spec/lucky/text_helpers/svg_inliner_spec.cr | 21 ++++++++++++++++++++- src/lucky/page_helpers/svg_inliner.cr | 13 +++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/spec/lucky/text_helpers/svg_inliner_spec.cr b/spec/lucky/text_helpers/svg_inliner_spec.cr index 13d110b15..22507d67c 100644 --- a/spec/lucky/text_helpers/svg_inliner_spec.cr +++ b/spec/lucky/text_helpers/svg_inliner_spec.cr @@ -12,6 +12,14 @@ class TextHelperTestPage def with_inlined_and_styled_svg inline_svg("lucky_logo.svg", false) end + + def with_additional_attributes + inline_svg("lucky_logo.svg", data_very: "lucky") + end + + def with_original_styles_and_additional_attributes + inline_svg("lucky_logo.svg", strip_styling: false, data_very: "lucky") + end end describe Lucky::SvgInliner do @@ -45,10 +53,21 @@ describe Lucky::SvgInliner do inlined_svg.should_not contain %(fill="none" stroke="#2a2a2a" class="logo") end - it "allows inlinging an svg without stripping its styling attributes" do + it "allows inlining an svg without stripping its styling attributes" do inlined_svg = view.tap(&.with_inlined_and_styled_svg).render inlined_svg.should start_with %(