marko-js / htmljs-parser

An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values
MIT License
135 stars 20 forks source link

fix: improve detection of regexp vs division #168

Closed DylanPiercey closed 10 months ago

DylanPiercey commented 10 months ago

Description

Improves the detection of division vs regexp expressions to assume division when the preceding character is a quote. This improves parsing of css grid properties in particular.

Note in the future this could probably be improved to remove the regexp state altogether for non script sections, but that would require a larger refactor.

Checklist:

changeset-bot[bot] commented 10 months ago

🦋 Changeset detected

Latest commit: 2842daeecfca09a744ba100225cb18c2f256e8f5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------- | ----- | | htmljs-parser | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

codecov[bot] commented 10 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (4b2b199) 93.85% compared to head (2842dae) 93.78%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #168 +/- ## ========================================== - Coverage 93.85% 93.78% -0.07% ========================================== Files 27 27 Lines 1301 1303 +2 Branches 297 298 +1 ========================================== + Hits 1221 1222 +1 Misses 51 51 - Partials 29 30 +1 ``` | [Files](https://app.codecov.io/gh/marko-js/htmljs-parser/pull/168?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marko-js) | Coverage Δ | | |---|---|---| | [src/states/EXPRESSION.ts](https://app.codecov.io/gh/marko-js/htmljs-parser/pull/168?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marko-js#diff-c3JjL3N0YXRlcy9FWFBSRVNTSU9OLnRz) | `93.25% <75.00%> (-0.54%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.