1 # frozen_string_literal: true
4 class SvgToSymbolTransform < InlineSvg::CustomTransformation
12 class AssetRoutingTransform < InlineSvg::CustomTransformation
14 with_svg(doc) do |svg|
15 svg.css("image").each do |image|
16 image["href"] = ActionController::Base.helpers.asset_path(image["href"].sub(%r{\A[./]+}, ""))
23 InlineSvg.configure do |config|
24 config.add_custom_transformation(:attribute => :to_symbol, :transform => OpenStreetMap::SvgToSymbolTransform)
25 config.add_custom_transformation(:attribute => :asset_path, :transform => OpenStreetMap::AssetRoutingTransform, :default_value => true)