jamesmartin / inline_svg

Embed SVG documents in your Rails views and style them with CSS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`inline_svg_tag` Adds extra space after output

fredboyle opened this issue · comments

In the following example code:

<a href="https://nowhere.invalid"><%= inline_svg_tag "interface/interface_smile.svg" %>No gear</a>

A whitespace character is added to the "No gear" string.

The output ends up being:

<a href="..."><svg>...</svg> No gear</a>

Expected output:

<a href="..."><svg>...</svg>No gear</a>

Investigating the issue a fix was found when modifying lib/inline_svg/transform_pipeline.rb in the "inline_svg" gem by changing line #7 to:

end.to_html.strip!

Could this fix be implemented or is there an alternative solution to remove the extra space that shouldn't be there?

Thanks for opening this issue and suggesting a fix. ✨

Please feel free to open a Pull Request with your suggested change and I'll get it merged into the Gem. Bonus points for writing a test that reproduces the problem. 👍

@fredboyle please close the issue as it was merged/fixed.