Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

changed <svg> tag regexes #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LordPachelbel
Copy link

@LordPachelbel LordPachelbel commented Jul 24, 2018

To solve issue #19, these regex changes (based on https://github.com/tiagoporto/jquery-svg-to-inline/issues/19#issuecomment-407540570 ) allow for inlining SVG files with

  • underscores in the <svg> tag — <svg id="Layer_1"
  • semicolons in the <svg> tag — <svg style="enable-background:new 0 0 512 512;"
  • no attributes or whitespace in the tag — <svg>

The regexes are now less restrictive, so they should cover any situation. The <svg> one says "match <svg, then match anything that isn't a > character, then match a > character." While I was at it, I changed the regexes that find HTML comments, the <?xml tag, and the class attribute in the same manner.

This is the SVG I used for testing (I had to change its extension to .txt so I could attach it to this pull request, so change it back to .svg before using it):

calculator.txt

@LordPachelbel
Copy link
Author

LordPachelbel commented Jul 24, 2018

After submitting this pull request the Travis CI build failed at the npm ci step, so it hasn't checked my code.

@tiagoporto
Copy link
Owner

tiagoporto commented Oct 21, 2018

Hi @LordPachelbel its not a problem with your code, I need update some dependencies now.
Thanks for your contribution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants