Fix XML entities in generated JavaScript#553
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/gregberge/svgr/JBtwUZdGHsrgqZXtoweY8WvsLBM9 |
Codecov Report
@@ Coverage Diff @@
## main #553 +/- ##
==========================================
+ Coverage 90.89% 90.99% +0.10%
==========================================
Files 31 31
Lines 1076 1077 +1
Branches 325 323 -2
==========================================
+ Hits 978 980 +2
Misses 92 92
+ Partials 6 5 -1
Continue to review full report at Codecov.
|
|
@gregberge I hope you enjoyed your vacation, and that you can merge and release this fix soon :D |
|
friendly ping for @gregberge, we need this fix :) |
|
@gregberge, sorry to bother but any ETA when this pull request will be merged and a new version will be published? Very surprised this little users ran into this problem (or assumed it's SVGO's fault?) |
Co-authored-by: Michel Jung <[email protected]>
Co-authored-by: Michel Jung <[email protected]>
7798218 to
7b8cc96
Compare
|
Sorry for the delay, thanks for this fix! |
Summary
This patch fixes the issue reported in #516. The fix targets
@svgr/hast-util-to-babel-ast. The handler for XML text parsing now creates a string literal which content is entity-decoded via theentitiespackage. The reference for XML entities is available here: https://www.w3.org/TR/REC-xml/#sec-internal-entTo be fully XML compliant, we would also have to substitute external entities, those declared in the body of the document. However this is a substantial endeavor out of scope of this fix.
Test plan
Two tests have been added in
hast-util-to-babel-asttest folder. See capture below: